mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
Compare commits
557 Commits
jarred/exp
...
bun-v0.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
940570af59 | ||
|
|
bdfb5a91b1 | ||
|
|
29b986684d | ||
|
|
e48a0877ef | ||
|
|
22837d69b7 | ||
|
|
af306b523b | ||
|
|
ba20fd7566 | ||
|
|
6d1330d601 | ||
|
|
f3be0c79c2 | ||
|
|
10c01af692 | ||
|
|
a68a1983cf | ||
|
|
90a647fb72 | ||
|
|
3cbf209d5b | ||
|
|
bee45c4fdc | ||
|
|
61202cb464 | ||
|
|
0091944161 | ||
|
|
78cd857bf6 | ||
|
|
4fe1b4df1c | ||
|
|
2a1235c9db | ||
|
|
4bb41b95a8 | ||
|
|
f78f4854a4 | ||
|
|
ff01dfa03d | ||
|
|
638b204d1e | ||
|
|
58e88c4aed | ||
|
|
8433919342 | ||
|
|
8150b9aeba | ||
|
|
01601fc8a7 | ||
|
|
7b24042d5f | ||
|
|
2177dda242 | ||
|
|
0585c86390 | ||
|
|
528caab47c | ||
|
|
b150df34e0 | ||
|
|
da80c3b309 | ||
|
|
e8804bd80f | ||
|
|
2300886008 | ||
|
|
57ed3c89a2 | ||
|
|
1a284a1c94 | ||
|
|
f12dd51c00 | ||
|
|
e00c1e99d6 | ||
|
|
39323b46ba | ||
|
|
9dff80aeee | ||
|
|
9f7d05bab4 | ||
|
|
53c0a4b568 | ||
|
|
8f460a9be3 | ||
|
|
204b07f46b | ||
|
|
a48a02bade | ||
|
|
2326a1e105 | ||
|
|
c4dc6d9bff | ||
|
|
6213a73e6f | ||
|
|
9c109b744f | ||
|
|
42c1d54b3f | ||
|
|
5e634cd612 | ||
|
|
79c7fe0f7a | ||
|
|
8e86d2cf1d | ||
|
|
4e12a4c013 | ||
|
|
e869cdca9f | ||
|
|
ab565f1a3c | ||
|
|
90cd3bf4cb | ||
|
|
9752ee8819 | ||
|
|
9f1e0660dd | ||
|
|
7c05bb7d1d | ||
|
|
bb0faacf06 | ||
|
|
9ae35ec581 | ||
|
|
b1ca1eb228 | ||
|
|
832502555c | ||
|
|
1176a07c93 | ||
|
|
3770102843 | ||
|
|
cf7c80d42d | ||
|
|
84632571c7 | ||
|
|
af1061e47a | ||
|
|
e1ce0e8467 | ||
|
|
468c475359 | ||
|
|
8902a19bb4 | ||
|
|
f4e72be58f | ||
|
|
c20b5414c4 | ||
|
|
1a0438b3b1 | ||
|
|
da2f85ba4b | ||
|
|
bc65e40313 | ||
|
|
a188c7d791 | ||
|
|
f2cccdd1fb | ||
|
|
6621de709e | ||
|
|
98e9b93b7e | ||
|
|
3aef65597b | ||
|
|
c98e007ff7 | ||
|
|
3350e63004 | ||
|
|
d71b37e292 | ||
|
|
1c7485e58c | ||
|
|
872428de89 | ||
|
|
93441babd8 | ||
|
|
1328285bbc | ||
|
|
9912a4ce98 | ||
|
|
d5186ee663 | ||
|
|
9e2910365a | ||
|
|
3be2571a31 | ||
|
|
6352e95d0f | ||
|
|
b6a72f7d72 | ||
|
|
b923134023 | ||
|
|
6e82fa0dab | ||
|
|
9511bf94d5 | ||
|
|
03983ac24e | ||
|
|
347dbc6237 | ||
|
|
b2a6f3f81c | ||
|
|
5a89f30841 | ||
|
|
244585b82a | ||
|
|
bc727e8d79 | ||
|
|
472589aa14 | ||
|
|
ba9825eca9 | ||
|
|
f4d1a3c33d | ||
|
|
be05f65339 | ||
|
|
dcabe86ea8 | ||
|
|
2a98c323c1 | ||
|
|
be5ed44580 | ||
|
|
93010b71b4 | ||
|
|
62d9a18ec6 | ||
|
|
b0bb65f494 | ||
|
|
09ab634d32 | ||
|
|
bba102c076 | ||
|
|
9719ae096d | ||
|
|
0854188f3c | ||
|
|
0cfcb96e5c | ||
|
|
39bbb7b9cd | ||
|
|
e3d828648e | ||
|
|
ed8f381b5c | ||
|
|
516369d748 | ||
|
|
dff9fd8ae1 | ||
|
|
3f3dc56da5 | ||
|
|
5dbbad5cc4 | ||
|
|
24522f7d74 | ||
|
|
4173b03f54 | ||
|
|
bdd5502aef | ||
|
|
2f301e39d7 | ||
|
|
c75ae828bc | ||
|
|
b0598f64ea | ||
|
|
8721ba7474 | ||
|
|
d7a5b60405 | ||
|
|
4f0d4cee0b | ||
|
|
a0b6892c09 | ||
|
|
359df89fe3 | ||
|
|
dca47a565e | ||
|
|
19922287aa | ||
|
|
5944c91de4 | ||
|
|
350569655b | ||
|
|
092f9ac766 | ||
|
|
dfb65ef1ca | ||
|
|
57ca04444b | ||
|
|
125d88bd65 | ||
|
|
6f2554b13a | ||
|
|
b66ef23167 | ||
|
|
812f641ee3 | ||
|
|
4bd9cccbc9 | ||
|
|
2ebe9ad101 | ||
|
|
fc907e2f81 | ||
|
|
8a02ad48a5 | ||
|
|
c30ec608b1 | ||
|
|
d18e73aa57 | ||
|
|
292668ed43 | ||
|
|
2a6edf00cd | ||
|
|
cbd2c56a1f | ||
|
|
83c54db836 | ||
|
|
abf5f873b6 | ||
|
|
1d1a70c21f | ||
|
|
d59e7b27b0 | ||
|
|
0108695438 | ||
|
|
34b55c3350 | ||
|
|
2fc89a69e3 | ||
|
|
cb70d08573 | ||
|
|
cd69063660 | ||
|
|
0822e67594 | ||
|
|
7e79d9dae6 | ||
|
|
bb84a8cc6c | ||
|
|
2c429f7732 | ||
|
|
4f966f30a5 | ||
|
|
ac123f2371 | ||
|
|
48dadc17f6 | ||
|
|
fb4feea8c3 | ||
|
|
4749669e74 | ||
|
|
6f2749d13d | ||
|
|
e43d3e995f | ||
|
|
c20df72d73 | ||
|
|
b8941666b4 | ||
|
|
4f7ff6db2c | ||
|
|
0045fc36d6 | ||
|
|
44ae01dded | ||
|
|
e48b5945c3 | ||
|
|
194b60191d | ||
|
|
172aede346 | ||
|
|
b85cfa52d0 | ||
|
|
a90760b597 | ||
|
|
3fc0c899c9 | ||
|
|
2e58176ac7 | ||
|
|
54a7c4290a | ||
|
|
4debcdcbbb | ||
|
|
f23d7c5259 | ||
|
|
d009e02c1d | ||
|
|
1b894ad9f6 | ||
|
|
336aa0d9a5 | ||
|
|
c015c0c0cd | ||
|
|
2fa09f7c09 | ||
|
|
47c660f2e1 | ||
|
|
4b7917ba8f | ||
|
|
e2b9f23231 | ||
|
|
78e1144ca5 | ||
|
|
212182f745 | ||
|
|
00c5e07b56 | ||
|
|
6a5f34a6bc | ||
|
|
bd9f137b1b | ||
|
|
34792c15f1 | ||
|
|
69b101adcf | ||
|
|
bd0f74a6fd | ||
|
|
61ff6b8e49 | ||
|
|
65ea600b55 | ||
|
|
c8f2def7c4 | ||
|
|
eba7b8b51e | ||
|
|
f53c4a0716 | ||
|
|
4e3dd3aadc | ||
|
|
476bcfdae3 | ||
|
|
0510d63ee5 | ||
|
|
9a2ce8e1fa | ||
|
|
da540bc449 | ||
|
|
33f344288f | ||
|
|
a8da18cbc4 | ||
|
|
ec334111c9 | ||
|
|
92229ac0f6 | ||
|
|
3a34f2e952 | ||
|
|
3ae0accbe3 | ||
|
|
db740a4eb4 | ||
|
|
a6bf54668a | ||
|
|
029ba1ea44 | ||
|
|
4541606469 | ||
|
|
039bf6ecdb | ||
|
|
04467b82d3 | ||
|
|
a3cfd26125 | ||
|
|
945cd08931 | ||
|
|
afb6684782 | ||
|
|
8c67007926 | ||
|
|
e012efa124 | ||
|
|
468c22de0e | ||
|
|
fe71f70775 | ||
|
|
d90049be28 | ||
|
|
2d67691038 | ||
|
|
e6eba3e484 | ||
|
|
de657fe350 | ||
|
|
fb5b0ffedd | ||
|
|
9f43f92cfa | ||
|
|
5db15b6ec7 | ||
|
|
f1d3aade3b | ||
|
|
0826f77101 | ||
|
|
c92c7beece | ||
|
|
0ba399d8ed | ||
|
|
abdc26a5fc | ||
|
|
306c7dda61 | ||
|
|
a703afeddd | ||
|
|
6585226de7 | ||
|
|
28cc70cf50 | ||
|
|
bbe0a3d58c | ||
|
|
68b6e80b91 | ||
|
|
4b647fdbec | ||
|
|
4a3b03a063 | ||
|
|
06ef8cf9eb | ||
|
|
3b6259edf3 | ||
|
|
7a1ca0bc0c | ||
|
|
ae01e9b98d | ||
|
|
afcbcd231c | ||
|
|
d7151f07bf | ||
|
|
6997367242 | ||
|
|
1e81d4d2a9 | ||
|
|
71943a83e6 | ||
|
|
ca6514c77c | ||
|
|
d27a599ec2 | ||
|
|
e0c0dc7191 | ||
|
|
574be79253 | ||
|
|
209391d01c | ||
|
|
2600c4f4c4 | ||
|
|
2335780618 | ||
|
|
bd11b04c18 | ||
|
|
41260ecd18 | ||
|
|
db4caf0d42 | ||
|
|
197b3ee34d | ||
|
|
bfac22d951 | ||
|
|
d95ffe6302 | ||
|
|
76bb26de83 | ||
|
|
16c7674304 | ||
|
|
f59892f647 | ||
|
|
86642cbdd5 | ||
|
|
882c963398 | ||
|
|
4d61ce4dd7 | ||
|
|
3becf2d801 | ||
|
|
bae23210f4 | ||
|
|
6cda74994b | ||
|
|
160f83cf9e | ||
|
|
3e0a78bc0d | ||
|
|
d51d39ef32 | ||
|
|
70912ec46f | ||
|
|
3c6d687423 | ||
|
|
c3c14ff9ce | ||
|
|
3b0a19efe0 | ||
|
|
cfb549b7ce | ||
|
|
842bb9cba2 | ||
|
|
ca90126cc4 | ||
|
|
10b4b872a2 | ||
|
|
0daff24b16 | ||
|
|
f74771144e | ||
|
|
687b22908f | ||
|
|
0babc4037b | ||
|
|
33832aa887 | ||
|
|
063ac7dce5 | ||
|
|
e490577a7d | ||
|
|
dbad798c92 | ||
|
|
bdc3308271 | ||
|
|
de35ad995e | ||
|
|
8ce74beafa | ||
|
|
7b48e206db | ||
|
|
4b1f89114e | ||
|
|
6e4da63abe | ||
|
|
49929405df | ||
|
|
c0273a09f1 | ||
|
|
56c689d684 | ||
|
|
5ecf48a21d | ||
|
|
bb00c519c3 | ||
|
|
d2b15c0d75 | ||
|
|
5467f2fc1a | ||
|
|
bff37539b9 | ||
|
|
88b992abd6 | ||
|
|
340982e58a | ||
|
|
a23ce8245d | ||
|
|
96046fcaa2 | ||
|
|
d2d7e08145 | ||
|
|
1aa81cd90d | ||
|
|
1167bcef3d | ||
|
|
a9ab385183 | ||
|
|
58fd17867d | ||
|
|
3b684308c3 | ||
|
|
3ee7467d66 | ||
|
|
81f9e0b9e6 | ||
|
|
dbda84ff87 | ||
|
|
b6e19438ea | ||
|
|
85b6d448ce | ||
|
|
7245f90b2d | ||
|
|
ba743d776a | ||
|
|
4a8b254652 | ||
|
|
86296897e5 | ||
|
|
68fa7ec2d0 | ||
|
|
d18ff76912 | ||
|
|
a4a62d9874 | ||
|
|
d9cf78c267 | ||
|
|
84d7234f24 | ||
|
|
5354a44d6a | ||
|
|
610c75a492 | ||
|
|
e914c5f3d2 | ||
|
|
f1d6dd2c8b | ||
|
|
4f2077a4de | ||
|
|
79cd2fbfe0 | ||
|
|
e2b9d4c869 | ||
|
|
07b26525ca | ||
|
|
49ba78767c | ||
|
|
d92a3861c9 | ||
|
|
fea9faaf4c | ||
|
|
b1b459435f | ||
|
|
b7d7fac635 | ||
|
|
a1d3191b89 | ||
|
|
516f264138 | ||
|
|
07416311ce | ||
|
|
ece2a3ccfd | ||
|
|
70126c074f | ||
|
|
adbeb24979 | ||
|
|
b918e7e372 | ||
|
|
b55e64ffa3 | ||
|
|
d09194f05a | ||
|
|
6fbfd69699 | ||
|
|
7b549c6551 | ||
|
|
af0972d6f2 | ||
|
|
020ce32779 | ||
|
|
0b68ccd742 | ||
|
|
fc1a37cced | ||
|
|
7ed1b19d94 | ||
|
|
6dce0c1e03 | ||
|
|
9ca283bb43 | ||
|
|
e1677bb774 | ||
|
|
7eb887edd5 | ||
|
|
122ef023dd | ||
|
|
c51c65325f | ||
|
|
f43234bc30 | ||
|
|
223410eab3 | ||
|
|
dc3309d130 | ||
|
|
d2e1c7955b | ||
|
|
f280758fa7 | ||
|
|
a2d8026810 | ||
|
|
0e2fb5d132 | ||
|
|
df01d4de6f | ||
|
|
ecda693e38 | ||
|
|
6a4712f4c9 | ||
|
|
3b8cabcc81 | ||
|
|
395deef793 | ||
|
|
9f74fba395 | ||
|
|
f96f299377 | ||
|
|
079fe523d4 | ||
|
|
13653a93a2 | ||
|
|
19d472c847 | ||
|
|
d49e0a5fa1 | ||
|
|
e66466cc1a | ||
|
|
69627d8a47 | ||
|
|
f4245c90e8 | ||
|
|
913891905f | ||
|
|
9dc7f25825 | ||
|
|
faa3c867e2 | ||
|
|
756c41719c | ||
|
|
65f4ea1e18 | ||
|
|
3d827342a5 | ||
|
|
ea2a4aa181 | ||
|
|
7626746904 | ||
|
|
fa2f60cdd5 | ||
|
|
21a1134de3 | ||
|
|
3bd725d80b | ||
|
|
da0bb118dc | ||
|
|
ddd5ed1cc2 | ||
|
|
ee6643ce8b | ||
|
|
38f1eb0701 | ||
|
|
87d01c9f4a | ||
|
|
dd72bf5ab6 | ||
|
|
741d35f0b3 | ||
|
|
0e74b0081c | ||
|
|
d264d4e4ba | ||
|
|
534f9cf509 | ||
|
|
d1db1fdd79 | ||
|
|
2a54b9f138 | ||
|
|
b5612b303b | ||
|
|
3436ee9ded | ||
|
|
923e2c5c5d | ||
|
|
bbc95209f0 | ||
|
|
e73da759b9 | ||
|
|
6e8e16d916 | ||
|
|
05ec7232bf | ||
|
|
254a2b779b | ||
|
|
12dde03184 | ||
|
|
e01dde3fa2 | ||
|
|
983bc9bbdc | ||
|
|
dbbde8d858 | ||
|
|
a16a5c209c | ||
|
|
494177773f | ||
|
|
5e26ed1320 | ||
|
|
0f6a4854e3 | ||
|
|
089bce8828 | ||
|
|
da210d75e8 | ||
|
|
6e7c954161 | ||
|
|
248354d549 | ||
|
|
db5a78d5f6 | ||
|
|
b5173afc44 | ||
|
|
f51f303b35 | ||
|
|
c6d42bf0a9 | ||
|
|
7d1439d570 | ||
|
|
81f3a52e89 | ||
|
|
feb7adcd08 | ||
|
|
84be179f7c | ||
|
|
5b4c8449a8 | ||
|
|
8036244eb2 | ||
|
|
6e46883ca7 | ||
|
|
6a69c971d4 | ||
|
|
4a7067a0a2 | ||
|
|
3d5e021dea | ||
|
|
379566f052 | ||
|
|
112741dfde | ||
|
|
8c41ac8b23 | ||
|
|
4aee9094a7 | ||
|
|
1a24d77699 | ||
|
|
e4b054060e | ||
|
|
6510697627 | ||
|
|
0e5955287b | ||
|
|
2fc4a5c564 | ||
|
|
657903c03e | ||
|
|
a381233e40 | ||
|
|
5162ab0bbf | ||
|
|
2b66058a95 | ||
|
|
adbbe2963c | ||
|
|
f96528adde | ||
|
|
ea10dacc92 | ||
|
|
f234456bd0 | ||
|
|
fe88e7bcf4 | ||
|
|
35b249d23e | ||
|
|
db6ac5f51b | ||
|
|
6aa88ae931 | ||
|
|
8a0836c239 | ||
|
|
cbe78efb9c | ||
|
|
7cc2661aa6 | ||
|
|
c3d3d70ced | ||
|
|
8b75f56577 | ||
|
|
9541d268de | ||
|
|
a58adfcaa2 | ||
|
|
2884b759c3 | ||
|
|
70cc0f47bb | ||
|
|
2fac623977 | ||
|
|
7396fae4e2 | ||
|
|
904bf17a51 | ||
|
|
e0e32986c7 | ||
|
|
54730377e2 | ||
|
|
28ecf60267 | ||
|
|
154e049638 | ||
|
|
e80f865974 | ||
|
|
c88625436c | ||
|
|
68aa776217 | ||
|
|
0666f8151a | ||
|
|
1fba2dc20f | ||
|
|
ca4120afec | ||
|
|
2eb09c1fec | ||
|
|
f6f40b5b64 | ||
|
|
bed0227a8f | ||
|
|
9fd6f635cd | ||
|
|
f12ed9904b | ||
|
|
1010bae1a3 | ||
|
|
c09d7cf839 | ||
|
|
f8131f42bc | ||
|
|
175bbdd3c3 | ||
|
|
515172263b | ||
|
|
324784cd6e | ||
|
|
0c951bd012 | ||
|
|
62dab0703d | ||
|
|
fc75a0dea6 | ||
|
|
166c353ddb | ||
|
|
ae90b3deea | ||
|
|
7257094662 | ||
|
|
ecabda3ced | ||
|
|
18794b18b3 | ||
|
|
e70ac2ce82 | ||
|
|
1261560214 | ||
|
|
caa747ba71 | ||
|
|
fad34bb4ab | ||
|
|
dd9e7de689 | ||
|
|
d975ab19db | ||
|
|
41c9896e11 | ||
|
|
7a4084a23f | ||
|
|
6be0a4653f | ||
|
|
08961dc3ce | ||
|
|
274b139aa8 | ||
|
|
5a51ea3957 | ||
|
|
ed9981c9c6 | ||
|
|
3ce9f07171 | ||
|
|
adc4e9b23c | ||
|
|
a9ca6c8a07 | ||
|
|
a432247053 | ||
|
|
d19f939e7d | ||
|
|
ea84c6dc3c | ||
|
|
ca2a3f69ff | ||
|
|
1b3d46d92c | ||
|
|
0b1fc17636 | ||
|
|
26f53dbcd8 | ||
|
|
320e0460e0 | ||
|
|
97cb54de2e | ||
|
|
3050d5a1a4 | ||
|
|
7005f4c43c | ||
|
|
2961b7c8ca | ||
|
|
cb639afb57 | ||
|
|
64d35e1dbf | ||
|
|
c895f10bbf | ||
|
|
24d1479ea8 | ||
|
|
3731376943 | ||
|
|
75d2ee53b0 | ||
|
|
1e9e42618b | ||
|
|
cabe773a4f |
66
.gitignore
vendored
66
.gitignore
vendored
@@ -3,4 +3,68 @@ zig-cache
|
||||
*.wasm
|
||||
|
||||
*.o
|
||||
*.a
|
||||
*.a
|
||||
profile.json
|
||||
|
||||
node_modules
|
||||
.swcrc
|
||||
yarn.lock
|
||||
dist
|
||||
*.log
|
||||
*.out.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
|
||||
bench
|
||||
github
|
||||
out.*
|
||||
out
|
||||
.parcel-cache
|
||||
esbuilddir
|
||||
*.bun
|
||||
parceldist
|
||||
esbuilddir
|
||||
outdir/
|
||||
outcss
|
||||
.next
|
||||
txt.js
|
||||
.idea
|
||||
.vscode/cpp*
|
||||
|
||||
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-*/bin/*
|
||||
|
||||
packages/bun-cli/bin/*
|
||||
15
.gitmodules
vendored
Normal file
15
.gitmodules
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# [submodule "src/deps/zig-clap"]
|
||||
# path = src/deps/zig-clap
|
||||
# url = https://github.com/Hejsil/zig-clap
|
||||
[submodule "src/deps/picohttpparser"]
|
||||
path = src/deps/picohttpparser
|
||||
url = https://github.com/h2o/picohttpparser/
|
||||
ignore = dirty
|
||||
[submodule "src/javascript/jsc/WebKit"]
|
||||
path = src/javascript/jsc/WebKit
|
||||
url = git@github.com:/Jarred-Sumner/WebKit
|
||||
ignore = dirty
|
||||
[submodule "src/deps/mimalloc"]
|
||||
path = src/deps/mimalloc
|
||||
url = https://github.com/microsoft/mimalloc
|
||||
ignore = dirty
|
||||
48
.vscode/c_cpp_properties.json
vendored
Normal file
48
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/src/javascript/jsc/bindings/root.h"
|
||||
],
|
||||
"includePath": [
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/WTF/Headers",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/*",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/bindings/",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/Source/bmalloc/",
|
||||
"${workspaceFolder}/src/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers/"
|
||||
],
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceFolder}/src/javascript/jsc/bindings/*",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/WTF/Headers/**",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/WebKitBuild/Release/*",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/bindings/**",
|
||||
"${workspaceFolder}/src/JavaScript/jsc/WebKit/Source/bmalloc/**",
|
||||
"${workspaceFolder}/src/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers/"
|
||||
],
|
||||
"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=0",
|
||||
"DU_DISABLE_RENAMING=1"
|
||||
],
|
||||
"macFrameworkPath": [],
|
||||
"compilerPath": "/usr/local/opt/llvm/bin/clang",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++11",
|
||||
"intelliSenseMode": "macos-clang-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
541
.vscode/launch.json
vendored
541
.vscode/launch.json
vendored
@@ -2,39 +2,532 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Test",
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"stdio": null,
|
||||
"stopOnEntry": false,
|
||||
"program": "/usr/local/bin/zig",
|
||||
"name": "Transpile small",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
// "/Users/jarred/Desktop/webpack4.js"
|
||||
// "/Users/jarred/Code/bun/examples/css-stress-test/nexty/node_modules/next/dist/build/utils.js"
|
||||
"./dotenv-load-check.ts"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/examples/css-stress-test",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Eval Error",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/spjs",
|
||||
"args": [
|
||||
"error.js",
|
||||
"--resolve=dev",
|
||||
"--outdir=outcss"
|
||||
// "--origin=https://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": ["test", "${file}"],
|
||||
"presentation": {
|
||||
"hidden": false,
|
||||
"group": "",
|
||||
"order": 1
|
||||
},
|
||||
"env": {
|
||||
"TERM": "xterm"
|
||||
}
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": ".bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./examples/hello-next/node_modules.server.bun"
|
||||
// "--origin=https://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Discord",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"discord"
|
||||
// "--origin=https://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Eval",
|
||||
"program": "${workspaceFolder}/build/debug/macos-x86_64/spjs",
|
||||
"args": [
|
||||
"./src/index.tsx"
|
||||
// "--origin=https://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/examples/css-stress-test",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "cppdbg",
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/zig-cache/bin/esdev",
|
||||
"name": "Dev Launch",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./simple.css",
|
||||
"--resolve=dev",
|
||||
"--outdir=outcss",
|
||||
"--origin=https://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Release Serve",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
// "args": ["--serve", "--origin=http://localhost:3000"],
|
||||
"args": ["dev", "--origin=http://localhost:3000"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Serve",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "args": ["--serve", "--origin=http://localhost:3000"],
|
||||
"args": ["dev", "--origin=http://localhost:3000"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Serve aarch64",
|
||||
"program": "${workspaceFolder}/build/macos-aarch64/bun",
|
||||
// "args": ["--serve", "--origin=http://localhost:3000"],
|
||||
"args": ["dev", "--origin=http://ci.local:3000"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Lazy Build",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./src/index.tsx",
|
||||
"--resolve=lazy",
|
||||
"--origin=http://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/examples/simple-react",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Build",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"./src/index.tsx",
|
||||
"--resolve=dev",
|
||||
"--outdir=outcss",
|
||||
"--platform=browser",
|
||||
"--origin=http://localhost:9000/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/examples/css-stress-test",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Fixture serve",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo .bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "--use=bun-framework-next"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "PNPM .bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "./pages/index.js"],
|
||||
"cwd": "/Users/jarred/Build/pnpm-bun/packages/app",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "PNPM serve",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "/Users/jarred/Build/pnpm-bun/packages/app",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Mixed case resolve",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"build",
|
||||
"./index.js",
|
||||
"--origin=http://localhost:9000/",
|
||||
// "--use=./bun-framework-next",
|
||||
"--platform=browser"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/examples/lotta-modules/",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Build .bun lotta-modules",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "./index.js", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/lotta-modules/",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Dev CRA",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["dev", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-create-react-app/",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Fragment",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Context Bun Bug",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "./code.js"],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Context Bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["bun", "--use=next"],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Bun-hello",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/packages/bun-hello",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Integration Test Dev",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/integration/snippets",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Integration Test Dev (no hmr)",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["--disable-hmr"],
|
||||
"cwd": "${workspaceFolder}/integration/snippets",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Fixtures Dev",
|
||||
"program": "a",
|
||||
"args": ["dev"],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Fixtures Rel",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
"args": ["dev"],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
|
||||
"request": "launch",
|
||||
"name": "Context Dev",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Context Rel",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
"args": [],
|
||||
"cwd": "/Users/jarred/Build/context/www",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug Dev",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["dev"],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Type-only import",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"bun",
|
||||
"./src/test/fixtures/type-only-import.ts",
|
||||
"--external=react"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "lldb",
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"logging": {
|
||||
"moduleLoad": false
|
||||
}
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Dev lotta-modules",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["dev", "./index.js", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/lotta-modules/",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Build .bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": [
|
||||
"bun",
|
||||
// "./index.js",
|
||||
"--origin=http://localhost:9000/",
|
||||
"--use=./bun-framework-next",
|
||||
"--platform=browser"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/examples/hello-next/",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "PNPM Resolve symlink",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["--resolve=dev", "test-pnpm.js", "--platform=browser"],
|
||||
"cwd": "${workspaceFolder}/examples/css-stress-test",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Demo Print .bun",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"args": ["./node_modules.bun"],
|
||||
"cwd": "${workspaceFolder}/examples/simple-react",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "DAev Launch",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
"args": ["./simple.jsx", "--resolve=disable"],
|
||||
"cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"name": "esbuild",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "/Users/jarred/Code/esbuild/cmd/esbuild",
|
||||
"cwd": "/Users/jarred/Code/bun/src/test/fixtures",
|
||||
"args": ["--bundle", "--outfile=out.esbuild.js", "await.ts"]
|
||||
},
|
||||
|
||||
// {
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch (other)",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "args": ["./simple.jsx", "--resolve=disable"],
|
||||
// "cwd": "${workspaceFolder}/src/test/fixtures",
|
||||
// "console": "internalConsole"
|
||||
// },
|
||||
// {
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=disable",
|
||||
// "--cwd",
|
||||
// "/Users/jarredsumner/Code/bun/src/test/fixtures",
|
||||
// "escape-chars.js"
|
||||
// ],
|
||||
// "cwd": "${workspaceFolder}",
|
||||
// "console": "internalConsole"
|
||||
// }
|
||||
// {
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
// "--cwd",
|
||||
// "/Users/jarredsumner/Builds/esbuild/bench/three/src/",
|
||||
// "./entry.js",
|
||||
// "-o",
|
||||
// "out"
|
||||
// ],
|
||||
// "cwd": "/Users/jarredsumner/Builds/esbuild/bench/three/src",
|
||||
// "console": "internalConsole"
|
||||
// }
|
||||
// {
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
// "--cwd",
|
||||
// "/Users/jarredsumner/Builds/esbuild/bench/three/src/",
|
||||
// "./entry.js",
|
||||
// "-o",
|
||||
// "out"
|
||||
// ],
|
||||
// "cwd": "${workspaceFolder}",
|
||||
// "console": "internalConsole"
|
||||
// }
|
||||
// {
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// // "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
// "--cwd",
|
||||
// "./src/api/demo",
|
||||
// "pages/index.jsx",
|
||||
// "-o",
|
||||
// "out",
|
||||
// "--origin=https://hello.com/",
|
||||
// "--serve"
|
||||
// ],
|
||||
// "cwd": "${workspaceFolder}",
|
||||
// "console": "internalConsole"
|
||||
// }
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Rome",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"program": "${workspaceFolder}/build/macos-x86_64/bun",
|
||||
// "preLaunchTask": "build",
|
||||
"args": [
|
||||
"--resolve=dev",
|
||||
// "--resolve=lazy",
|
||||
"--cwd",
|
||||
"${workspaceFolder}/bench/rome/src",
|
||||
"entry",
|
||||
"--platform=node",
|
||||
// "@romejs/js-analysis/evaluators/modules/ImportCall.ts",
|
||||
"--outdir=${workspaceFolder}/bench/rome/src/out",
|
||||
// "@romejs/cli-diagnostics/banners/success.json",
|
||||
"--origin=https://hello.com/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/bench/rome/src",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Rome Dev",
|
||||
// "program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
"program": "${workspaceFolder}/packages/debug-bun-cli-darwin-x64/bin/bun-debug",
|
||||
// "preLaunchTask": "build",
|
||||
"args": [
|
||||
"--resolve=dev",
|
||||
// "--resolve=lazy",
|
||||
"--cwd",
|
||||
"${workspaceFolder}/bench/rome/src",
|
||||
"entry",
|
||||
"--platform=node",
|
||||
// "@romejs/js-analysis/evaluators/modules/ImportCall.ts",
|
||||
"--outdir=${workspaceFolder}/bench/rome/src/out",
|
||||
// "@romejs/cli-diagnostics/banners/success.json",
|
||||
"--origin=https://hello.com/"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/bench/rome/src",
|
||||
"console": "internalConsole"
|
||||
}
|
||||
// {
|
||||
// "type": "lldb",
|
||||
// "request": "launch",
|
||||
// "name": "Dev Launch",
|
||||
// "program": "${workspaceFolder}/build/bin/debug/bun",
|
||||
// "preLaunchTask": "build",
|
||||
// "args": [
|
||||
// "--resolve=dev",
|
||||
// "--cwd",
|
||||
// "/",
|
||||
// "/Users/jarredsumner/Code/bun/src/test/fixtures/img-bug.js",
|
||||
// "-o",
|
||||
// "out"
|
||||
// ],
|
||||
// "cwd": "${workspaceFolder}",
|
||||
// "console": "internalConsole",
|
||||
// "presentation": {
|
||||
// "hidden": false,
|
||||
// "group": "",
|
||||
// "order": 1
|
||||
// }
|
||||
// }
|
||||
]
|
||||
}
|
||||
|
||||
134
.vscode/settings.json
vendored
Normal file
134
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"git.autoRepositoryDetection": "openEditors",
|
||||
"search.quickOpen.includeSymbols": false,
|
||||
"search.seedWithNearestWord": true,
|
||||
"search.smartCase": true,
|
||||
"search.exclude": {
|
||||
"src/javascript/jsc/WebKit/**/*": true
|
||||
},
|
||||
"search.followSymlinks": false,
|
||||
"search.useIgnoreFiles": true,
|
||||
"zig.buildOnSave": false,
|
||||
"[zig]": {
|
||||
"editor.defaultFormatter": "tiehuis.zig"
|
||||
},
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"integration/snapshots": true,
|
||||
"integration/snapshots-no-hmr": true
|
||||
},
|
||||
"C_Cpp.files.exclude": {
|
||||
"**/.vscode": true,
|
||||
"src/javascript/jsc/WebKit/JSTests": true,
|
||||
"src/javascript/jsc/WebKit/Tools": true,
|
||||
"src/javascript/jsc/WebKit/WebDriverTests": true,
|
||||
"src/javascript/jsc/WebKit/WebKit.xcworkspace": true,
|
||||
"src/javascript/jsc/WebKit/WebKitLibraries": true,
|
||||
"src/javascript/jsc/WebKit/Websites": true,
|
||||
"src/javascript/jsc/WebKit/resources": true,
|
||||
"src/javascript/jsc/WebKit/LayoutTests": true,
|
||||
"src/javascript/jsc/WebKit/ManualTests": true,
|
||||
"src/javascript/jsc/WebKit/PerformanceTests": true,
|
||||
"src/javascript/jsc/WebKit/WebKitLegacy": true,
|
||||
"src/javascript/jsc/WebKit/WebCore": true,
|
||||
"src/javascript/jsc/WebKit/WebDriver": true,
|
||||
"src/javascript/jsc/WebKit/WebKitBuild": true,
|
||||
"src/javascript/jsc/WebKit/WebInspectorUI": true
|
||||
},
|
||||
"[cpp]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"[h]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"[c]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
},
|
||||
"files.associations": {
|
||||
"*.idl": "cpp",
|
||||
"memory": "cpp",
|
||||
"iostream": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"random": "cpp",
|
||||
"ios": "cpp",
|
||||
"filesystem": "cpp",
|
||||
"__locale": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"__mutex_base": "cpp",
|
||||
"__string": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"__config": "cpp",
|
||||
"__nullptr": "cpp",
|
||||
"exception": "cpp",
|
||||
"__bit_reference": "cpp",
|
||||
"atomic": "cpp",
|
||||
"utility": "cpp",
|
||||
"sstream": "cpp",
|
||||
"__functional_base": "cpp",
|
||||
"new": "cpp",
|
||||
"__debug": "cpp",
|
||||
"__errc": "cpp",
|
||||
"__hash_table": "cpp",
|
||||
"__node_handle": "cpp",
|
||||
"__split_buffer": "cpp",
|
||||
"__threading_support": "cpp",
|
||||
"__tuple": "cpp",
|
||||
"array": "cpp",
|
||||
"bit": "cpp",
|
||||
"bitset": "cpp",
|
||||
"cctype": "cpp",
|
||||
"chrono": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"complex": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"deque": "cpp",
|
||||
"fstream": "cpp",
|
||||
"functional": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iomanip": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"istream": "cpp",
|
||||
"iterator": "cpp",
|
||||
"limits": "cpp",
|
||||
"locale": "cpp",
|
||||
"mutex": "cpp",
|
||||
"optional": "cpp",
|
||||
"ostream": "cpp",
|
||||
"ratio": "cpp",
|
||||
"stack": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"system_error": "cpp",
|
||||
"thread": "cpp",
|
||||
"tuple": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"vector": "cpp",
|
||||
"__bits": "cpp",
|
||||
"__tree": "cpp",
|
||||
"map": "cpp",
|
||||
"numeric": "cpp",
|
||||
"set": "cpp",
|
||||
"__memory": "cpp",
|
||||
"memory_resource": "cpp"
|
||||
},
|
||||
"go.logging.level": "off",
|
||||
"cmake.configureOnOpen": false
|
||||
}
|
||||
28
.vscode/tasks.json
vendored
28
.vscode/tasks.json
vendored
@@ -3,9 +3,17 @@
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "zig build",
|
||||
|
||||
"type": "process",
|
||||
"command": "zig",
|
||||
"args": ["build"],
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": false,
|
||||
"clear": false
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -26,7 +34,15 @@
|
||||
"label": "test",
|
||||
"type": "shell",
|
||||
"command": "zig",
|
||||
"args": ["test", "${file}", "-femit-bin=zig-cache/bin/test"],
|
||||
"args": [
|
||||
"test",
|
||||
"${file}",
|
||||
"--main-pkg-path",
|
||||
"${workspaceFolder}",
|
||||
"-femit-bin=${workspaceFolder}/zig-out/bin/test",
|
||||
";",
|
||||
"true"
|
||||
],
|
||||
|
||||
"group": {
|
||||
"kind": "test",
|
||||
@@ -34,7 +50,9 @@
|
||||
},
|
||||
"presentation": {
|
||||
"showReuseMessage": false,
|
||||
"clear": true
|
||||
"clear": true,
|
||||
"panel": "new",
|
||||
"reveal": "always"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
260
Makefile
Normal file
260
Makefile
Normal file
@@ -0,0 +1,260 @@
|
||||
OS_NAME := $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH_NAME_DENORAMLZIED_1 := $(shell uname -m)
|
||||
ARCH_NAME_DENORAMLZIED_2 := $(shell tr '[_]' '[--]' <<< $(ARCH_NAME_DENORAMLZIED_1))
|
||||
ARCH_NAME_DENORAMLZIED_3 := $(shell sed s/x86-64/x64/ <<< $(ARCH_NAME_DENORAMLZIED_2))
|
||||
ARCH_NAME := $(shell sed s/arm64/aarch64/ <<< $(ARCH_NAME_DENORAMLZIED_3))
|
||||
TRIPLET := $(OS_NAME)-$(ARCH_NAME)
|
||||
PACKAGE_DIR := packages/bun-cli-$(TRIPLET)
|
||||
DEBUG_PACKAGE_DIR := packages/debug-bun-cli-$(TRIPLET)
|
||||
BIN_DIR := $(PACKAGE_DIR)/bin
|
||||
RELEASE_BUN := $(shell realpath $(PACKAGE_DIR)/bin/bun)
|
||||
DEBUG_BIN := $(DEBUG_PACKAGE_DIR)/bin
|
||||
DEBUG_BIN_REALPATH := $(shell realpath $(DEBUG_PACKAGE_DIR)/bin)
|
||||
DEBUG_BUN := $(shell realpath $(DEBUG_BIN)/bun-debug)
|
||||
BUILD_ID := $(shell cat ./build-id)
|
||||
PACKAGE_JSON_VERSION := 0.0.$(BUILD_ID)
|
||||
BUN_BUILD_TAG := bun-v$(PACKAGE_JSON_VERSION)
|
||||
CC := clang
|
||||
CXX := clang++
|
||||
|
||||
bun: vendor build-obj bun-link-lld-release
|
||||
|
||||
vendor: api node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp jsc
|
||||
|
||||
build-obj:
|
||||
zig build obj -Drelease-fast
|
||||
|
||||
sign-macos-x64:
|
||||
gon sign.macos-x64.json
|
||||
|
||||
sign-macos-aarch64:
|
||||
gon sign.macos-aarch64.json
|
||||
|
||||
release-macos: all-js build-obj jsc-bindings-mac bun-link-lld-release
|
||||
|
||||
all-js: runtime_js fallback_decoder bun_error node-fallbacks
|
||||
|
||||
bin-dir:
|
||||
@echo $(BIN_DIR)
|
||||
|
||||
api:
|
||||
npm install; ./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
|
||||
|
||||
node-fallbacks:
|
||||
@cd src/node-fallbacks; npm install; npm run --silent build
|
||||
|
||||
fallback_decoder:
|
||||
@esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.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
|
||||
|
||||
bun_error:
|
||||
@cd packages/bun-error; npm install; npm run --silent build
|
||||
|
||||
JSC_BUILD_STEPS :=
|
||||
ifeq ($(OS_NAME),linux)
|
||||
JSC_BUILD_STEPS += jsc-build-linux jsc-copy-headers
|
||||
endif
|
||||
ifeq ($(OS_NAME),darwin)
|
||||
JSC_BUILD_STEPS += jsc-build-mac jsc-copy-headers
|
||||
endif
|
||||
|
||||
jsc: jsc-build jsc-bindings
|
||||
jsc-build: $(JSC_BUILD_STEPS)
|
||||
jsc-bindings: jsc-bindings-headers jsc-bindings-mac
|
||||
|
||||
jsc-bindings-headers:
|
||||
mkdir -p src/javascript/jsc/bindings-obj/
|
||||
zig build headers
|
||||
|
||||
bump:
|
||||
expr $(BUILD_ID) + 1 > build-id
|
||||
|
||||
|
||||
build_postinstall:
|
||||
@esbuild --bundle --format=cjs --platform=node --define:BUN_VERSION="\"$(PACKAGE_JSON_VERSION)\"" packages/bun-cli/scripts/postinstall.ts > packages/bun-cli/postinstall.js
|
||||
|
||||
write-package-json-version-cli: build_postinstall
|
||||
jq -S --raw-output '.version = "${PACKAGE_JSON_VERSION}"' packages/bun-cli/package.json > packages/bun-cli/package.json.new
|
||||
mv packages/bun-cli/package.json.new packages/bun-cli/package.json
|
||||
|
||||
write-package-json-version:
|
||||
jq -S --raw-output '.version = "${PACKAGE_JSON_VERSION}"' $(PACKAGE_DIR)/package.json > $(PACKAGE_DIR)/package.json.new
|
||||
mv $(PACKAGE_DIR)/package.json.new $(PACKAGE_DIR)/package.json
|
||||
|
||||
tag:
|
||||
git tag $(BUN_BUILD_TAG)
|
||||
git push --tags
|
||||
|
||||
prepare-release: tag release-create write-package-json-version-cli write-package-json-version
|
||||
|
||||
release-create:
|
||||
gh release create --title "Bun v$(PACKAGE_JSON_VERSION)" "$(BUN_BUILD_TAG)"
|
||||
|
||||
release-cli-push:
|
||||
cd packages/bun-cli && npm pack --pack-destination /tmp/
|
||||
gh release upload $(BUN_BUILD_TAG) --clobber /tmp/bun-cli-$(PACKAGE_JSON_VERSION).tgz
|
||||
npm publish /tmp/bun-cli-$(PACKAGE_JSON_VERSION).tgz
|
||||
|
||||
release-mac-push: write-package-json-version
|
||||
cd $(PACKAGE_DIR) && npm pack --pack-destination /tmp/
|
||||
gh release upload $(BUN_BUILD_TAG) --clobber /tmp/bun-cli-$(TRIPLET)-$(PACKAGE_JSON_VERSION).tgz
|
||||
npm publish /tmp/bun-cli-$(TRIPLET)-$(PACKAGE_JSON_VERSION).tgz
|
||||
|
||||
dev-obj:
|
||||
zig build obj
|
||||
|
||||
dev: mkdir-dev dev-obj bun-link-lld-debug
|
||||
|
||||
mkdir-dev:
|
||||
mkdir -p $(DEBUG_PACKAGE_DIR)/bin
|
||||
|
||||
test-install:
|
||||
cd integration/scripts && npm install
|
||||
|
||||
test-all: test-install test-with-hmr test-no-hmr
|
||||
|
||||
copy-test-node-modules:
|
||||
rm -rf integration/snippets/package-json-exports/node_modules
|
||||
cp -r integration/snippets/package-json-exports/_node_modules_copy integration/snippets/package-json-exports/node_modules
|
||||
kill-bun:
|
||||
-killall -9 bun bun-debug
|
||||
|
||||
test-with-hmr: kill-bun copy-test-node-modules
|
||||
BUN_BIN=$(RELEASE_BUN) node integration/scripts/browser.js
|
||||
|
||||
test-no-hmr: kill-bun copy-test-node-modules
|
||||
-killall bun -9;
|
||||
DISABLE_HMR="DISABLE_HMR" BUN_BIN=$(RELEASE_BUN) node integration/scripts/browser.js
|
||||
|
||||
test-dev-with-hmr: copy-test-node-modules
|
||||
-killall bun-debug -9;
|
||||
BUN_BIN=$(DEBUG_BUN) node integration/scripts/browser.js
|
||||
|
||||
test-dev-no-hmr: copy-test-node-modules
|
||||
-killall bun-debug -9;
|
||||
DISABLE_HMR="DISABLE_HMR" BUN_BIN=$(DEBUG_BUN) node integration/scripts/browser.js
|
||||
|
||||
test-dev-all: test-dev-with-hmr test-dev-no-hmr
|
||||
|
||||
test-dev: test-dev-with-hmr
|
||||
|
||||
jsc-copy-headers:
|
||||
find src/javascript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/JavaScriptCore \;
|
||||
|
||||
jsc-build-mac-compile:
|
||||
cd src/javascript/jsc/WebKit && ICU_INCLUDE_DIRS="$(HOMEBREW_PREFIX)opt/icu4c/include" ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo"
|
||||
|
||||
jsc-build-linux-compile:
|
||||
CC=$(CC) CXX=$(CXX) cd src/javascript/jsc/WebKit && ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo"
|
||||
|
||||
jsc-build-mac: jsc-build-mac-compile jsc-build-mac-copy
|
||||
|
||||
jsc-build-linux: jsc-build-linux-compile jsc-build-mac-copy
|
||||
|
||||
jsc-build-mac-copy:
|
||||
cp src/javascript/jsc/WebKit/WebKitBuild/Release/lib/libJavaScriptCore.a src/deps/libJavaScriptCore.a
|
||||
cp src/javascript/jsc/WebKit/WebKitBuild/Release/lib/libWTF.a src/deps/libWTF.a
|
||||
cp src/javascript/jsc/WebKit/WebKitBuild/Release/lib/libbmalloc.a src/deps/libbmalloc.a
|
||||
|
||||
JSC_FILES := src/deps/libJavaScriptCore.a \
|
||||
src/deps/libWTF.a \
|
||||
src/deps/libbmalloc.a
|
||||
|
||||
|
||||
ifeq ($(OS_NAME),darwin)
|
||||
HOMEBREW_PREFIX := $(shell brew --prefix)/
|
||||
endif
|
||||
|
||||
SRC_DIR := src/javascript/jsc/bindings
|
||||
OBJ_DIR := src/javascript/jsc/bindings-obj
|
||||
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp)
|
||||
OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))
|
||||
INCLUDE_DIRS := -Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders \
|
||||
-Isrc/javascript/jsc/WebKit/WebKitBuild/Release/WTF/Headers \
|
||||
-Isrc/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers \
|
||||
-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/ \
|
||||
-Isrc/JavaScript/jsc/bindings/ \
|
||||
-Isrc/javascript/jsc/WebKit/Source/bmalloc
|
||||
|
||||
CLANG_FLAGS := $(INCLUDE_DIRS) \
|
||||
-std=gnu++1z \
|
||||
-stdlib=libc++ \
|
||||
-DSTATICALLY_LINKED_WITH_JavaScriptCore=1 \
|
||||
-DSTATICALLY_LINKED_WITH_WTF=1 \
|
||||
-DBUILDING_WITH_CMAKE=1 \
|
||||
-DNDEBUG=1 \
|
||||
-DNOMINMAX \
|
||||
-DIS_BUILD \
|
||||
-g \
|
||||
-DENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0 \
|
||||
-DBUILDING_JSCONLY__ \
|
||||
-DASSERT_ENABLED=0\
|
||||
-DDU_DISABLE_RENAMING=1
|
||||
|
||||
jsc-bindings-mac: $(OBJ_FILES)
|
||||
|
||||
|
||||
MACOS_ICU_FILES := $(HOMEBREW_PREFIX)opt/icu4c/lib/libicudata.a \
|
||||
$(HOMEBREW_PREFIX)opt/icu4c/lib/libicui18n.a \
|
||||
$(HOMEBREW_PREFIX)opt/icu4c/lib/libicuuc.a
|
||||
|
||||
MACOS_ICU_INCLUDE := $(HOMEBREW_PREFIX)opt/icu4c/include
|
||||
|
||||
MACOS_ICU_FLAGS := -l icucore \
|
||||
$(MACOS_ICU_FILES) \
|
||||
-I$(MACOS_ICU_INCLUDE)
|
||||
|
||||
BUN_LLD_FLAGS := $(OBJ_FILES) \
|
||||
${MACOS_ICU_FLAGS} \
|
||||
${JSC_FILES} \
|
||||
src/deps/picohttpparser.o \
|
||||
src/deps/mimalloc/libmimalloc.a \
|
||||
$(CLANG_FLAGS) \
|
||||
-fpie \
|
||||
|
||||
mimalloc:
|
||||
cd src/deps/mimalloc; cmake .; make;
|
||||
|
||||
bun-link-lld-debug:
|
||||
$(CXX) $(BUN_LLD_FLAGS) \
|
||||
$(DEBUG_BIN)/bun-debug.o \
|
||||
-Wl,-dead_strip \
|
||||
-ftls-model=local-exec \
|
||||
-flto \
|
||||
-o $(DEBUG_BIN)/bun-debug
|
||||
|
||||
bun-link-lld-release:
|
||||
$(CXX) $(BUN_LLD_FLAGS) \
|
||||
$(BIN_DIR)/bun.o \
|
||||
-o $(BIN_DIR)/bun \
|
||||
-Wl,-dead_strip \
|
||||
-ftls-model=local-exec \
|
||||
-flto \
|
||||
-O3
|
||||
rm $(BIN_DIR)/bun.o
|
||||
|
||||
bun-link-lld-release-aarch64:
|
||||
$(CXX) $(BUN_LLD_FLAGS) \
|
||||
build/macos-aarch64/bun.o \
|
||||
-o build/macos-aarch64/bun \
|
||||
-Wl,-dead_strip \
|
||||
-ftls-model=local-exec \
|
||||
-flto \
|
||||
-O3
|
||||
|
||||
# We do this outside of build.zig for performance reasons
|
||||
# The C compilation stuff with build.zig is really slow and we don't need to run this as often as the rest
|
||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
|
||||
$(CXX) -c -o $@ $< \
|
||||
$(CLANG_FLAGS) \
|
||||
-O1
|
||||
|
||||
sizegen:
|
||||
$(CXX) src/javascript/jsc/headergen/sizegen.cpp -o /tmp/sizegen $(CLANG_FLAGS) -O1
|
||||
/tmp/sizegen > src/javascript/jsc/bindings/sizes.zig
|
||||
|
||||
picohttp:
|
||||
$(CC) -O3 -g -c src/deps/picohttpparser.c -Isrc/deps -o src/deps/picohttpparser.o; cd ../../
|
||||
|
||||
655
README.md
655
README.md
@@ -1,181 +1,600 @@
|
||||
# esdev
|
||||
# Bun
|
||||
|
||||
Incredibly fast ECMAScript & TypeScript bundler designed for development.
|
||||
Bun is a new:
|
||||
|
||||
## Motivation
|
||||
- JavaScript/TypeScript/JSX transpiler
|
||||
- JavaScript & CSS bundler
|
||||
- Development server with 60fps Hot Module Reloading (& WIP support for React Fast Refresh)
|
||||
- JavaScript Runtime Environment (powered by JavaScriptCore, what WebKit/Safari uses)
|
||||
|
||||
JavaScript bundlers run very slow in web browsers.
|
||||
All in one fast & easy-to-use tool. Instead of 1,000 node_modules for development, you only need Bun.
|
||||
|
||||
## Purpose
|
||||
**Bun is experimental software**. Join [Bun's Discord](https://bun.sh/discord) for help and have a look at [things that don't work yet](#things-that-dont-work-yet).
|
||||
|
||||
The purpose of esdev is to very quickly convert ECMAScript/TypeScript into something a web browser can execute.
|
||||
## Install:
|
||||
|
||||
Goals:
|
||||
```
|
||||
# Global install is recommended so bun appears in your $PATH
|
||||
npm install -g bun-cli
|
||||
```
|
||||
|
||||
- Transpile fast inside a web browser. "Fast" is defined as "<= 3ms per un-minified file up to 1000 LOC" without build caching (FS cache yes).
|
||||
- Transpile JSX to ECMAScript
|
||||
- Remove TypeScript annotations
|
||||
- Conditionally support React Fast Refresh
|
||||
- Rewrite CommonJS/SystemJS/UMD imports and exports to ESM
|
||||
- Support most of tsconfig.json/jsconfig.json
|
||||
- Support `defines` like in esbuild
|
||||
- Support esbuild plugins
|
||||
- Support importing CSS files from JavaScript
|
||||
- Tree-shaking
|
||||
### Getting started
|
||||
|
||||
Non-goals:
|
||||
## Using Bun with Next.js
|
||||
|
||||
- Bundling for production
|
||||
- Minification
|
||||
- AST plugins
|
||||
- Support Node.js
|
||||
- CommonJS, UMD, IIFE
|
||||
- ES6 to ES5
|
||||
- Supporting non-recent versions of Chromium, Firefox, or Safari. (No IE)
|
||||
In your project folder root (where `package.json` is):
|
||||
|
||||
## How it works
|
||||
```bash
|
||||
npm install -D bun-framework-next
|
||||
bun bun --use next
|
||||
bun
|
||||
```
|
||||
|
||||
Much of the code is a line-for-line port of esbuild to Zig, with a few important differences.
|
||||
Many of Next.js' features are supported, but not all.
|
||||
|
||||
### Implementation differences
|
||||
Here's what doesn't work yet:
|
||||
|
||||
#### Moar lookup tables
|
||||
- `getStaticPaths`
|
||||
- same-origin `fetch` inside of `getStaticProps` or `getServerSideProps`
|
||||
- locales, zones, `assetPrefix` (workaround: change `--origin \"http://localhsot:3000/assetPrefixInhere\"`)
|
||||
- `next/image` is polyfilled to a regular `<img src>` tag.
|
||||
- `proxy` and anything else in `next.config.js`
|
||||
- API, catch-all & catch-all fallback routes. Dynamic routes _are_ supported.
|
||||
|
||||
### Why not just use esbuild?
|
||||
When using Next.js, Bun automatically reads configuration from `.env.local`, `.env.development` and `.env` (in that order). `process.env.NEXT_PUBLIC_` and `process.env.NEXT_` automatically are replaced via `--define`.
|
||||
|
||||
#### Missing features
|
||||
Currently, any time you import new dependencies from `node_modules`, you will need to re-run `bun bun --use next`. This will eventually be automatic.
|
||||
|
||||
- Hot Module Reloading
|
||||
- Rewrite CommonJS/SystemJS/UMD imports and exports to ESM
|
||||
- React Fast Refresh
|
||||
## Using Bun with single page apps
|
||||
|
||||
#### Go WASM performance isn't great.
|
||||
In your project folder root (where `package.json` is):
|
||||
|
||||
There's a number of reasons for this:
|
||||
```bash
|
||||
bun bun ./entry-point-1.js ./entry-point-2.jsx
|
||||
bun
|
||||
```
|
||||
|
||||
- Unlike native targets, Go's WASM target runs the garbage collector on the same thread as the application. Since this usecase is very constrained (no need for shared memory, or long-term objects), rewriting in Zig lets us get away with a bump allocator -- skipping garbage collection entirely. This is faster than what Go does and possibly Rust, since this zeroes out the heap in one call at the end, rather than progressively zeroing memory.
|
||||
- Goroutines cross the JS<>WASM binding, which is very slow. The more goroutines you use, the slower your code runs. When building a Zig project in single-threaded mode, Zig's `comptime` feature compiles away most of the difference.
|
||||
- Slow startup time: unless you use TinyGo, Go WASM binaries are > 2 MB. In esbuild's case, at the time of writing its 6 MB. That's a lot of code for the web browser to download & compile.
|
||||
By default, `bun` will look for any HTML files in the `public` directory and serve that. For browsers navigating to the page, the `.html` file extension is optional in the URL, and `index.html` will automatically rewrite for the directory.
|
||||
|
||||
#### Different constraints enable performance improvements
|
||||
Here are examples of routing from `public/` and how they're matched:
|
||||
| Dev Server URL | File Path |
|
||||
|----------------|-----------|
|
||||
| /dir | public/dir/index.html |
|
||||
| / | public/index.html |
|
||||
| /index | public/index.html |
|
||||
| /hi | public/hi.html |
|
||||
| /file | public/file.html |
|
||||
| /font/Inter.woff2 | public/font/Inter.woff2 |
|
||||
| /hello | public/index.html |
|
||||
|
||||
If bundler means "merge N source files into 1 or few source file(s)", esdev is most definitely not a bundler. Unlike most bundlers today, esdev deliberately outputs
|
||||
If `public/index.html` exists, it becomes the default page instead of a 404 page, unless that pathname has a file extension.
|
||||
|
||||
If bundler means "turn my development code into something a browser can run",
|
||||
#### Using Bun with Create React App
|
||||
|
||||
### Compatibility Table
|
||||
To use Bun with `create-react-app`, there are two changes you will need to make in `public/index.html`:
|
||||
|
||||
| Feature | esbuild | esdev |
|
||||
| ------------------------------------ | ------- | ----- |
|
||||
| JSX (transform) | ✅ | ⌛ |
|
||||
| TypeScript (transform) | ✅ | ⌛ |
|
||||
| React Fast Refresh | ❌ | ⌛ |
|
||||
| Hot Module Reloading | ❌ | ⌛ |
|
||||
| Minification | ✅ | ❌ |
|
||||
| Tree Shaking | ✅ | ⌛ |
|
||||
| Incremental builds | ✅ | ⌛ |
|
||||
| CSS | ✅ | 🗓️ |
|
||||
| Expose CSS dependencies per file | ✅ | 🗓️ |
|
||||
| CommonJS, IIFE, UMD outputs | ✅ | ❌ |
|
||||
| Node.js build target | ✅ | ❌ |
|
||||
| Code Splitting | ✅ | ⌛ |
|
||||
| Browser build target | ✅ | ⌛ |
|
||||
| Bundling for production | ✅ | ❌ |
|
||||
| Support older browsers | ✅ | ❌ |
|
||||
| Plugins | ✅ | 🗓️ |
|
||||
| AST Plugins | ❌ | ❌ |
|
||||
| Filesystem Cache API (for plugins) | ❓ | 🗓️ |
|
||||
| Transform to ESM with `bundle` false | ❓ | ⌛ |
|
||||
1. Replace `%PUBLIC_URL%` with `/`
|
||||
2. Insert `<script type="module" async src="/src/index.js">` just before `</body>`
|
||||
|
||||
Key:
|
||||
These changes are (sadly) necessary until Bun supports parsing & transpiling HTML.
|
||||
|
||||
| Tag | Meaning |
|
||||
| --- | ------------------------------------------ |
|
||||
| ✅ | Compatible |
|
||||
| ❌ | Not supported, and no plans to change that |
|
||||
| ⌛ | In-progress |
|
||||
| 🗓️ | Planned but work has not started |
|
||||
| ❓ | Unknown |
|
||||
In your project folder root (where `package.json` is):
|
||||
|
||||
#### Notes
|
||||
```bash
|
||||
bun bun ./src/index.js
|
||||
bun
|
||||
```
|
||||
|
||||
##### Hot Module Reloading & React Fast Refresh
|
||||
From there, Bun relies on the filesystem for mapping dev server paths to source files. All URL paths are relative to the project root (where `package.json` is located).
|
||||
|
||||
esdev exposes a runtime API to support Hot Module Reloading and React Fast Refresh. React Fast Refresh depends on Hot Module Reloading to work, but you can turn either of them off. esdev itself doesn't serve bundled files, it's up to the development server to provide that.
|
||||
Here are examples of routing source code file paths:
|
||||
|
||||
##### Code Splitting
|
||||
| Dev Server URL | File Path (relative to cwd) |
|
||||
| -------------------------- | --------------------------- |
|
||||
| /src/components/Button.tsx | src/components/Button.tsx |
|
||||
| /src/index.tsx | src/index.tsx |
|
||||
| /pages/index.js | pages/index.js |
|
||||
|
||||
esdev supports code splitting the way browsers do natively: through ES Modules. This works great for local development files. It doesn't work great for node_modules or for production due to the sheer number of network requests. There are plans to make this better, stay tuned.
|
||||
You do not need to include file extensions in `import` paths. CommonJS-style import paths without the file extension works.
|
||||
|
||||
##### Support older browsers
|
||||
You can override the public directory by passing `--public-dir="path-to-folder"`.
|
||||
|
||||
To simplify the parser, esdev doesn't support lowering features to non-current browsers. This means if you run a development build with esdev with, for example, optional chaining, it won't work in Internet Explorer 11. If you want to support older browsers, use a different tool.
|
||||
If no directory is specified and `./public/` doesn't exist, Bun will try `./static/`. If `./static/` does not exist, but won't serve from a public directory. If you pass `--public-dir=./` Bun will serve from the current directory, but it will check the current directory last instead of first.
|
||||
|
||||
#### Implementation Notes
|
||||
## Using Bun with TypeScript
|
||||
|
||||
##### HMR & Fast Refresh implementation
|
||||
TypeScript just works. There's nothing to configure and nothing extra to install. If you import a `.ts` or `.tsx` file, Bun will transpile it into JavaScript. Bun also transpiles `node_modules` containing `.ts` or `.tsx` files. This is powered by Bun's TypeScript transpiler, so it's fast.
|
||||
|
||||
This section only applies when Hot Module Reloading is enabled. When it's off, none of this part runs. React Fast Refresh depends on Hot Module Reloading.
|
||||
Bun also reads `tsconfig.json`, including `baseUrl` and `paths`.
|
||||
|
||||
###### What is hot module reloading?
|
||||
## Using Tailwind with Bun
|
||||
|
||||
HMR: "hot module reloading"
|
||||
[Tailwind](https://tailwindcss.com/) is a popular CSS utility framework. Currently, the easiest way to use Tailwind with Bun is through Tailwind's CLI. That means running both `bun` and `tailwind`, and importing the file `tailwind`'s CLI outputs.
|
||||
|
||||
A lot of developers know what it does -- but what actually is it and how does it work? Essentially, it means when a source file changes, automatically reload the code without reloading the web page.
|
||||
Tailwind's docs talk more about [Tailwind's CLI usage](https://tailwindcss.com/docs/installation#watching-for-changes), but the gist is you'll want to run this:
|
||||
|
||||
A big caveat here is JavaScript VMs don't expose an API to "unload" parts of the JavaScript context. In all HMR implementations, What really happens is this:
|
||||
```bash
|
||||
npx tailwindcss -i ./src/tailwind.css -o ./dist/tailwind.css --watch
|
||||
```
|
||||
|
||||
1. Load a new copy of the code that changed
|
||||
2. Update references to the old code to point to the new code
|
||||
3. Handle errors
|
||||
From there, make sure to import the `dist/tailwind.css` file (or what you chose as the output).
|
||||
|
||||
The old code still lives there, in your browser's JavaScript VM until the page is refreshed. If any past references are kept (side effects!), undefined behavior happens. That's why, historically (by web standards), HMR has a reputation for being buggy.
|
||||
## Things that don't work yet
|
||||
|
||||
Loading code is easy. The hard parts are updating references and handling errors.
|
||||
Bun is a project with incredibly large scope, and it's early days.
|
||||
|
||||
There are two ways to update references:
|
||||
| Feature | In |
|
||||
| ---------------------------------------------------------------------------------------------------------------------- | -------------- |
|
||||
| ~Symlinks~ | Resolver |
|
||||
| [Finish Fast Refresh](https://github.com/Jarred-Sumner/bun/issues/18) | JSX Transpiler |
|
||||
| Source Maps | JavaScript |
|
||||
| Source Maps | CSS |
|
||||
| [Private Class Fields](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields) | JS Transpiler |
|
||||
| [Import Assertions](https://github.com/tc39/proposal-import-assertions) | JS Transpiler |
|
||||
| [`extends`](https://www.typescriptlang.org/tsconfig#extends) in tsconfig.json | TS Transpiler |
|
||||
| [jsx](https://www.typescriptlang.org/tsconfig)\* in tsconfig.json | TS Transpiler |
|
||||
| [TypeScript Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html) | TS Transpiler |
|
||||
| `@jsxPragma` comments | JS Transpiler |
|
||||
| JSX source file name | JS Transpiler |
|
||||
| Sharing `.bun` files | Bun |
|
||||
| [Finish fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | Bun.js |
|
||||
| [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) | Bun.js |
|
||||
| `bun run` command | Bun.js |
|
||||
|
||||
- Update all module imports
|
||||
- Update the exports
|
||||
<sup>JS Transpiler == JavaScript Transpiler</sup><br/>
|
||||
<sup>TS Transpiler == TypeScript Transpiler</sup><br/>
|
||||
<sup>Bun.js == Bun's JavaScriptCore integration that executes JavaScript. Similar to how Node.js & Deno embed V8.</sup><br/>
|
||||
|
||||
Either approach works.
|
||||
### Limitations & intended usage
|
||||
|
||||
###### How it's implemented in esdev
|
||||
Bun is great for building websites & webapps. For libraries, consider using Rollup or esbuild instead. Bun currently doesn't minify code and Bun's dead code elimination doesn't look beyond the current file.
|
||||
|
||||
At build time, esdev replaces all import URLs with import manifests that wrap the real module.
|
||||
Today, Bun is focused on:
|
||||
|
||||
In the simple case, that looks like this:
|
||||
- Development, not production
|
||||
- Compatibility with existing frameworks & tooling
|
||||
|
||||
Ideally, most projects can use Bun with their existing tooling while making few changes to their codebase. That means using Bun in development, and continuing to use Webpack, esbuild, or another bundler in production. Using two bundlers might sound strange at first, but after all the production-only AST transforms, minification, and special development/production-only imported files...it's not far from the status quo.
|
||||
|
||||
Longer-term, Bun intends to replace Node.js, Webpack, Babel, and PostCSS (in production).
|
||||
|
||||
# Configuration
|
||||
|
||||
### Loaders
|
||||
|
||||
A loader determines how to map imports & file extensions to transforms and output.
|
||||
|
||||
Currently, Bun implements the following loaders:
|
||||
|
||||
| Input | Loader | Output |
|
||||
| ----- | ----------------------------- | ------ |
|
||||
| .js | JSX + JavaScript | .js |
|
||||
| .jsx | JSX + JavaScript | .js |
|
||||
| .ts | TypeScript + JavaScript | .js |
|
||||
| .tsx | TypeScript + JSX + JavaScript | .js |
|
||||
| .mjs | JavaScript | .js |
|
||||
| .css | CSS | .css |
|
||||
| .env | Env | N/A |
|
||||
| .\* | file | string |
|
||||
|
||||
Everything else is treated as `file`. `file` replaces the import with a URL (or a path).
|
||||
|
||||
You can configure which loaders map to which extensions by passing `--loaders` to `bun`. For example:
|
||||
|
||||
```
|
||||
bun --loader=.js:js
|
||||
```
|
||||
|
||||
This will disable JSX transforms for `.js` files.
|
||||
|
||||
#### CSS in JS
|
||||
|
||||
When importing CSS in JavaScript-like loaders, CSS is treated special.
|
||||
|
||||
By default, Bun will transform a statement like this:
|
||||
|
||||
```js
|
||||
import "../styles/global.css";
|
||||
```
|
||||
|
||||
##### When `platform` is `browser`:
|
||||
|
||||
```js
|
||||
globalThis.document?.dispatchEvent(
|
||||
new CustomEvent("onimportcss", {
|
||||
detail: "http://localhost:3000/styles/globals.css",
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
An event handler for turning that into a `<link>` is automatically registered when HMR is enabled. That event handler can be turned off either in a framework's `package.json` or by setting `globalThis["Bun_disableCSSImports"] = true;` in client-side code. Additionally, you can get a list of every .css file imported this way via `globalThis["__BUN"].allImportedStyles`.
|
||||
|
||||
##### When `platform` is `bun`:
|
||||
|
||||
```js
|
||||
//@import url("http://localhost:3000/styles/globals.css");
|
||||
```
|
||||
|
||||
Additionally, Bun exposes an API for SSR/SSG that returns a flat list of URLs to css files imported. That function is `Bun.getImportedStyles()`.
|
||||
|
||||
```ts
|
||||
import { Button as _Button } from "http://localhost:3000/src/components/button.KXk23UX3.js";
|
||||
addEventListener("fetch", async (event: FetchEvent) => {
|
||||
var route = Bun.match(event);
|
||||
const App = await import("pages/_app");
|
||||
|
||||
export let Button = _Button;
|
||||
// This returns all .css files that were imported in the line above.
|
||||
// It's recursive, so any file that imports a CSS file will be included.
|
||||
const appStylesheets = Bun.getImportedStyles();
|
||||
|
||||
import.meta.onUpdate(import.meta.url, (exports) => {
|
||||
if ("Button" in exports) {
|
||||
Button = exports["Button"];
|
||||
}
|
||||
// ...rest of code
|
||||
});
|
||||
```
|
||||
|
||||
Then, lets say you updated `button.tsx` from this:
|
||||
This is useful for preventing flash of unstyled content.
|
||||
|
||||
```tsx
|
||||
export const Button = ({ children }) => (
|
||||
<div className="Button">{children}</div>
|
||||
);
|
||||
### CSS Loader
|
||||
|
||||
Bun bundles `.css` files imported via `@import` into a single file. It doesn't autoprefix or minify CSS today. Multiple `.css` files imported in one JavaScript file will _not_ be bundled into one file. You'll have to import those from a `.css` file.
|
||||
|
||||
This input:
|
||||
|
||||
```css
|
||||
@import url("./hi.css");
|
||||
@import url("./hello.css");
|
||||
@import url("./yo.css");
|
||||
```
|
||||
|
||||
To this:
|
||||
Becomes:
|
||||
|
||||
```tsx
|
||||
export const Button = ({ children }) => (
|
||||
<div className="Button">
|
||||
<div className="Button-label">{children}</div>
|
||||
</div>
|
||||
);
|
||||
```css
|
||||
/* hi.css */
|
||||
/* ...contents of hi.css */
|
||||
/* hello.css */
|
||||
/* ...contents of hello.css */
|
||||
/* yo.css */
|
||||
/* ...contents of yo.css */
|
||||
```
|
||||
|
||||
This triggers the HMR client in esdev to:
|
||||
#### CSS runtime
|
||||
|
||||
1. import `/src/components/button.js` once again
|
||||
To support hot CSS reloading, Bun inserts `@supports` annotations into CSS that tag which files a stylesheet is composed of. Browsers ignore this, so it doesn't impact styles.
|
||||
|
||||
By default, Bun's runtime code automatically listens to `onimportcss` and will insert the `event.detail` into a `<link rel="stylesheet" href={${event.detail}}>` if there is no existing `link` tag with that stylesheet. That's how Bun's equivalent of `style-loader` works.
|
||||
|
||||
### Frameworks
|
||||
|
||||
Frameworks preconfigure Bun to enable developers to use Bun with their existing tooling.
|
||||
|
||||
Frameworks are configured via the `framework` object in the `package.json` of the framework (not in the application's `package.json`):
|
||||
|
||||
Here is an example:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "bun-framework-next",
|
||||
"version": "0.0.0-18",
|
||||
"description": "",
|
||||
"framework": {
|
||||
"displayName": "Next.js",
|
||||
"static": "public",
|
||||
"assetPrefix": "_next/",
|
||||
"router": {
|
||||
"dir": ["pages", "src/pages"],
|
||||
"extensions": [".js", ".ts", ".tsx", ".jsx"]
|
||||
},
|
||||
"css": "onimportcss",
|
||||
"development": {
|
||||
"client": "client.development.tsx",
|
||||
"fallback": "fallback.development.tsx",
|
||||
"server": "server.development.tsx",
|
||||
"css": "onimportcss",
|
||||
"define": {
|
||||
"client": {
|
||||
".env": "NEXT_PUBLIC_",
|
||||
"defaults": {
|
||||
"process.env.__NEXT_TRAILING_SLASH": "false",
|
||||
"process.env.NODE_ENV": "\"development\"",
|
||||
"process.env.__NEXT_ROUTER_BASEPATH": "''",
|
||||
"process.env.__NEXT_SCROLL_RESTORATION": "false",
|
||||
"process.env.__NEXT_I18N_SUPPORT": "false",
|
||||
"process.env.__NEXT_HAS_REWRITES": "false",
|
||||
"process.env.__NEXT_ANALYTICS_ID": "null",
|
||||
"process.env.__NEXT_OPTIMIZE_CSS": "false",
|
||||
"process.env.__NEXT_CROSS_ORIGIN": "''",
|
||||
"process.env.__NEXT_STRICT_MODE": "false",
|
||||
"process.env.__NEXT_IMAGE_OPTS": "null"
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
".env": "NEXT_",
|
||||
"defaults": {
|
||||
"process.env.__NEXT_TRAILING_SLASH": "false",
|
||||
"process.env.__NEXT_OPTIMIZE_FONTS": "false",
|
||||
"process.env.NODE_ENV": "\"development\"",
|
||||
"process.env.__NEXT_OPTIMIZE_IMAGES": "false",
|
||||
"process.env.__NEXT_OPTIMIZE_CSS": "false",
|
||||
"process.env.__NEXT_ROUTER_BASEPATH": "''",
|
||||
"process.env.__NEXT_SCROLL_RESTORATION": "false",
|
||||
"process.env.__NEXT_I18N_SUPPORT": "false",
|
||||
"process.env.__NEXT_HAS_REWRITES": "false",
|
||||
"process.env.__NEXT_ANALYTICS_ID": "null",
|
||||
"process.env.__NEXT_CROSS_ORIGIN": "''",
|
||||
"process.env.__NEXT_STRICT_MODE": "false",
|
||||
"process.env.__NEXT_IMAGE_OPTS": "null",
|
||||
"global": "globalThis",
|
||||
"window": "undefined"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Here are type definitions:
|
||||
|
||||
```ts
|
||||
type Framework = Environment & {
|
||||
// This changes what's printed in the console on load
|
||||
displayName?: string;
|
||||
|
||||
// This allows a prefix to be added (and ignored) to requests.
|
||||
// Useful for integrating an existing framework that expects internal routes to have a prefix
|
||||
// e.g. "_next"
|
||||
assetPrefix?: string;
|
||||
|
||||
development?: Environment;
|
||||
production?: Environment;
|
||||
|
||||
// The directory used for serving unmodified assets like fonts and images
|
||||
// Defaults to "public" if exists, else "static", else disabled.
|
||||
static?: string;
|
||||
|
||||
// "onimportcss" disables the automatic "onimportcss" feature
|
||||
// If the framework does routing, you may want to handle CSS manually
|
||||
// "facade" removes CSS imports from JavaScript files,
|
||||
// and replaces an imported object with a proxy that mimics CSS module support without doing any class renaming.
|
||||
css?: "onimportcss" | "facade";
|
||||
|
||||
// Bun's filesystem router
|
||||
router?: Router;
|
||||
};
|
||||
|
||||
type Define = {
|
||||
// By passing ".env", Bun will automatically load .env.local, .env.development, and .env if exists in the project root
|
||||
// (in addition to the processes' environment variables)
|
||||
// When "*", all environment variables will be automatically injected into the JavaScript loader
|
||||
// When a string like "NEXT_PUBLIC_", only environment variables starting with that prefix will be injected
|
||||
|
||||
".env": string | "*";
|
||||
|
||||
// These environment variables will be injected into the JavaScript loader
|
||||
// These are the equivalent of Webpack's resolve.alias and esbuild's --define.
|
||||
// Values are parsed as JSON, so they must be valid JSON. The only exception is '' is a valid string, to simplify writing stringified JSON in JSON.
|
||||
// If not set, `process.env.NODE_ENV` will be transformed into "development".
|
||||
defaults: Record<string, string>;
|
||||
};
|
||||
|
||||
type Environment = {
|
||||
// This is a wrapper for the client-side entry point for a route.
|
||||
// This allows frameworks to run initialization code on pages.
|
||||
client: string;
|
||||
// This is a wrapper for the server-side entry point for a route.
|
||||
// This allows frameworks to run initialization code on pages.
|
||||
server: string;
|
||||
// This runs when "server" code fails to load due to an exception.
|
||||
fallback: string;
|
||||
|
||||
// This is how environment variables and .env is configured.
|
||||
define?: Define;
|
||||
};
|
||||
|
||||
// Bun's filesystem router
|
||||
// Currently, Bun supports pages by either an absolute match or a parameter match.
|
||||
// pages/index.tsx will be executed on navigation to "/" and "/index"
|
||||
// pages/posts/[id].tsx will be executed on navigation to "/posts/123"
|
||||
// Routes & parameters are automatically passed to `fallback` and `server`.
|
||||
type Router = {
|
||||
// This determines the folder to look for pages
|
||||
dir: string[];
|
||||
|
||||
// These are the allowed file extensions for pages.
|
||||
extensions?: string[];
|
||||
};
|
||||
```
|
||||
|
||||
To use a framework, you pass `bun bun --use package-name`.
|
||||
|
||||
Your framework's package.json `name` should start with `bun-framework-`. This is so that people can type something like `bun bun --use next` and it will check `bun-framework-next` first. This is similar to how Babel plugins tend to start with `babel-plugin-`.
|
||||
|
||||
For developing frameworks, you can also do `bun bun --use ./relative-path-to-framework`.
|
||||
|
||||
If you're interested in adding a framework integration, please reach out. There's a lot here and it's not entirely documented yet.
|
||||
|
||||
# Reference
|
||||
|
||||
### `bun bun`
|
||||
|
||||
Run `bun bun ./path-to.js` to generate a `node_modules.bun` file containing all imported dependencies (recursively).
|
||||
|
||||
**Why bundle?**
|
||||
|
||||
- For browsers, loading entire apps without bundling dependencies is typically slow. With a fast bundler & transpiler, the bottleneck eventually becomes the web browser's ability to run many network requests concurrently. There are many workarounds for this. `<link rel="modulepreload">`, HTTP/3, etc but none are more effective than bundling. If you have reproducible evidence to the contrary, feel free to submit an issue. It would be better if bundling wasn't necessary.
|
||||
- On the server, bundling reduces the number of filesystem lookups to load JavaScript. While filesystem lookups are faster than HTTP requests, there's still overhead.
|
||||
|
||||
**What is `.bun`?**
|
||||
|
||||
The `.bun` file 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" 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. I hope people will eventually check it into version control so their coworkers don't have to run `npm install` as often.
|
||||
|
||||
##### 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) => {
|
||||
var 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.
|
||||
|
||||
**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:
|
||||
|
||||
```bash
|
||||
#!/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 depenendency" 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.
|
||||
|
||||
# Credits
|
||||
|
||||
- While written in Zig instead of Go, Bun's JS transpiler, CSS lexer, and node module resolver source code is based off of @evanw's esbuild project. @evanw did a fantastic job with esbuild.
|
||||
|
||||
# License
|
||||
|
||||
Bun itself is MIT-licensed.
|
||||
|
||||
However, JavaScriptCore (and WebKit) is LGPL-2 and Bun statically links it.
|
||||
|
||||
Per LGPL2:
|
||||
|
||||
> (1) If you statically link against an LGPL'd library, you must also provide your application in an object (not necessarily source) format, so that a user has the opportunity to modify the library and relink the application.
|
||||
|
||||
You can find the patched version of WebKit used by Bun here: https://github.com/jarred-sumner/webkit. If you would like to relink Bun with changes:
|
||||
|
||||
- `git submodule update --init --recursive`
|
||||
- `make jsc`
|
||||
- `zig build`
|
||||
|
||||
This compiles JavaScriptCore, compiles Bun's `.cpp` bindings for JavaScriptCore (which are the object files using JavaScriptCore) and outputs a new `bun` binary with your changes.
|
||||
|
||||
To successfully run `zig build`, you will need to install a patched version of Zig available here: https://github.com/jarred-sumner/zig/tree/jarred/zig-sloppy.
|
||||
|
||||
Bun also statically links these libraries:
|
||||
|
||||
- `libicu`, which can be found here: https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE
|
||||
- [`picohttp`](https://github.com/h2o/picohttpparser), which is dual-licensed under the Perl License or the MIT License
|
||||
- [`mimalloc`](https://github.com/microsoft/mimalloc), which is MIT licensed
|
||||
|
||||
For compatibiltiy reasons, these NPM packages are embedded into Bun's binary and injected if imported.
|
||||
|
||||
- [`assert`](https://npmjs.com/package/assert) (MIT license)
|
||||
- [`browserify-zlib`](https://npmjs.com/package/browserify-zlib) (MIT license)
|
||||
- [`buffer`](https://npmjs.com/package/buffer) (MIT license)
|
||||
- [`constants-browserify`](https://npmjs.com/package/constants-browserify) (MIT license)
|
||||
- [`crypto-browserify`](https://npmjs.com/package/crypto-browserify) (MIT license)
|
||||
- [`domain-browser`](https://npmjs.com/package/domain-browser) (MIT license)
|
||||
- [`events`](https://npmjs.com/package/events) (MIT license)
|
||||
- [`https-browserify`](https://npmjs.com/package/https-browserify) (MIT license)
|
||||
- [`os-browserify`](https://npmjs.com/package/os-browserify) (MIT license)
|
||||
- [`path-browserify`](https://npmjs.com/package/path-browserify) (MIT license)
|
||||
- [`process`](https://npmjs.com/package/process) (MIT license)
|
||||
- [`punycode`](https://npmjs.com/package/punycode) (MIT license)
|
||||
- [`querystring-es3`](https://npmjs.com/package/querystring-es3) (MIT license)
|
||||
- [`stream-browserify`](https://npmjs.com/package/stream-browserify) (MIT license)
|
||||
- [`stream-http`](https://npmjs.com/package/stream-http) (MIT license)
|
||||
- [`string_decoder`](https://npmjs.com/package/string_decoder) (MIT license)
|
||||
- [`timers-browserify`](https://npmjs.com/package/timers-browserify) (MIT license)
|
||||
- [`tty-browserify`](https://npmjs.com/package/tty-browserify) (MIT license)
|
||||
- [`url`](https://npmjs.com/package/url) (MIT license)
|
||||
- [`util`](https://npmjs.com/package/util) (MIT license)
|
||||
- [`vm-browserify`](https://npmjs.com/package/vm-browserify) (MIT license)
|
||||
|
||||
# Developing Bun
|
||||
|
||||
Estimated: 30-90 minutes :(
|
||||
|
||||
Compile Zig:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/jarred-sumner/zig
|
||||
cd zig
|
||||
git checkout jarred/zig-sloppy-with-small-structs
|
||||
cmake . -DCMAKE_PREFIX_PATH=$(brew --prefix llvm) -DZIG_STATIC_LLVM=ON -DCMAKE_BUILD_TYPE=Release && make -j 16
|
||||
```
|
||||
|
||||
You'll want to make sure `zig` is in `$PATH`. The `zig` binary wil be in the same folder as the newly-cloned `zig` repo. If you use fish, you can run `fish_add_path (pwd)`.
|
||||
|
||||
In `bun`:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive --progress --depth=1
|
||||
make vendor
|
||||
zig build headers
|
||||
make jsc-bindings-mac
|
||||
zig build -Drelease-fast
|
||||
```
|
||||
|
||||
Note that `brew install zig` won't work. Bun uses a build of Zig with a couple patches.
|
||||
|
||||
Additionally, you'll need `cmake`, `npm` and `esbuild` installed globally.
|
||||
|
||||
362
build.zig
362
build.zig
@@ -1,28 +1,297 @@
|
||||
const std = @import("std");
|
||||
const resolve_path = @import("./src/resolver/resolve_path.zig");
|
||||
|
||||
pub fn build(b: *std.build.Builder) void {
|
||||
pub fn addPicoHTTP(step: *std.build.LibExeObjStep, comptime with_obj: bool) void {
|
||||
const picohttp = step.addPackage(.{
|
||||
.name = "picohttp",
|
||||
.path = .{ .path = "src/deps/picohttp.zig" },
|
||||
});
|
||||
|
||||
_ = step.addPackage(.{
|
||||
.name = "iguanaTLS",
|
||||
.path = .{ .path = "src/deps/iguanaTLS/src/main.zig" },
|
||||
});
|
||||
|
||||
step.addIncludeDir("src/deps");
|
||||
|
||||
if (with_obj) {
|
||||
step.addObjectFile("src/deps/picohttpparser.o");
|
||||
}
|
||||
|
||||
// step.add("/Users/jarred/Code/WebKit/WebKitBuild/Release/lib/libWTF.a");
|
||||
|
||||
// ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON"
|
||||
// set -gx ICU_INCLUDE_DIRS "/usr/local/opt/icu4c/include"
|
||||
// homebrew-provided icu4c
|
||||
}
|
||||
var x64 = "x64";
|
||||
pub fn build(b: *std.build.Builder) !void {
|
||||
// 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
|
||||
// for restricting supported target set are available.
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
|
||||
var cwd_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
const cwd: []const u8 = b.pathFromRoot(".");
|
||||
var exe: *std.build.LibExeObjStep = undefined;
|
||||
if (target.getCpuArch().isWasm()) {
|
||||
exe = b.addExecutable("esdev", "src/main_wasm.zig");
|
||||
} else {
|
||||
exe = b.addExecutable("esdev", "src/main.zig");
|
||||
var output_dir_buf = std.mem.zeroes([4096]u8);
|
||||
var bin_label = if (mode == std.builtin.Mode.Debug) "packages/debug-bun-cli-" else "packages/bun-cli-";
|
||||
|
||||
var triplet_buf: [64]u8 = undefined;
|
||||
var os_tagname = @tagName(target.getOs().tag);
|
||||
if (std.mem.eql(u8, os_tagname, "macos")) {
|
||||
os_tagname = "darwin";
|
||||
}
|
||||
|
||||
std.mem.copy(
|
||||
u8,
|
||||
&triplet_buf,
|
||||
os_tagname,
|
||||
);
|
||||
var osname = triplet_buf[0..os_tagname.len];
|
||||
triplet_buf[osname.len] = '-';
|
||||
|
||||
std.mem.copy(u8, triplet_buf[osname.len + 1 ..], @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");
|
||||
cpuArchName = cpuArchName[0..3];
|
||||
}
|
||||
|
||||
var triplet = triplet_buf[0 .. osname.len + cpuArchName.len + 1];
|
||||
|
||||
const output_dir_base = try std.fmt.bufPrint(&output_dir_buf, "{s}{s}/bin", .{ bin_label, triplet });
|
||||
const output_dir = b.pathFromRoot(output_dir_base);
|
||||
const bun_executable_name = if (mode == std.builtin.Mode.Debug) "bun-debug" else "bun";
|
||||
|
||||
if (target.getOsTag() == .wasi) {
|
||||
exe.enable_wasmtime = true;
|
||||
exe = b.addExecutable(bun_executable_name, "src/main_wasi.zig");
|
||||
exe.linkage = .dynamic;
|
||||
exe.setOutputDir(output_dir);
|
||||
} else if (target.getCpuArch().isWasm()) {
|
||||
// exe = b.addExecutable(
|
||||
// "bun",
|
||||
// "src/main_wasm.zig",
|
||||
// );
|
||||
// exe.is_linking_libc = false;
|
||||
// exe.is_dynamic = true;
|
||||
var lib = b.addExecutable(bun_executable_name, "src/main_wasm.zig");
|
||||
lib.single_threaded = true;
|
||||
// exe.want_lto = true;
|
||||
// exe.linkLibrary(lib);
|
||||
|
||||
if (mode == std.builtin.Mode.Debug) {
|
||||
// exception_handling
|
||||
var features = target.getCpuFeatures();
|
||||
features.addFeature(2);
|
||||
target.updateCpuFeatures(&features);
|
||||
} else {
|
||||
// lib.strip = true;
|
||||
}
|
||||
|
||||
lib.setOutputDir(output_dir);
|
||||
lib.want_lto = true;
|
||||
b.install_path = lib.getOutputSource().getPath(b);
|
||||
|
||||
std.debug.print("Build: ./{s}\n", .{b.install_path});
|
||||
b.default_step.dependOn(&lib.step);
|
||||
b.verbose_link = true;
|
||||
lib.setTarget(target);
|
||||
lib.setBuildMode(mode);
|
||||
|
||||
std.fs.deleteTreeAbsolute(std.fs.path.join(b.allocator, &.{ cwd, lib.getOutputSource().getPath(b) }) catch unreachable) catch {};
|
||||
var install = b.getInstallStep();
|
||||
lib.strip = false;
|
||||
lib.install();
|
||||
|
||||
const run_cmd = lib.run();
|
||||
run_cmd.step.dependOn(b.getInstallStep());
|
||||
if (b.args) |args| {
|
||||
run_cmd.addArgs(args);
|
||||
}
|
||||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
return;
|
||||
} else {
|
||||
exe = b.addExecutable(bun_executable_name, "src/main.zig");
|
||||
}
|
||||
// exe.setLibCFile("libc.txt");
|
||||
exe.linkLibC();
|
||||
// exe.linkLibCpp();
|
||||
exe.addPackage(.{
|
||||
.name = "clap",
|
||||
.path = .{ .path = "src/deps/zig-clap/clap.zig" },
|
||||
});
|
||||
|
||||
exe.setOutputDir(output_dir);
|
||||
var cwd_dir = std.fs.cwd();
|
||||
if (std.builtin.is_test) {
|
||||
var walker = cwd_dir.walk(std.heap.c_allocator) catch unreachable;
|
||||
|
||||
while (walker.next() catch unreachable) |entry| {
|
||||
if (std.mem.endsWith(u8, entry.basename, "_test.zig")) {
|
||||
std.debug.print("[test] Added {s}", .{entry.basename});
|
||||
_ = b.addTest(entry.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const runtime_hash = std.hash.Wyhash.hash(0, @embedFile("./src/runtime.out.js"));
|
||||
const runtime_version_file = std.fs.cwd().openFile("src/runtime.version", .{ .write = true }) catch unreachable;
|
||||
runtime_version_file.writer().print("{x}", .{runtime_hash}) catch unreachable;
|
||||
defer runtime_version_file.close();
|
||||
|
||||
const fallback_hash = std.hash.Wyhash.hash(0, @embedFile("./src/fallback.out.js"));
|
||||
const fallback_version_file = std.fs.cwd().openFile("src/fallback.version", .{ .write = true }) catch unreachable;
|
||||
fallback_version_file.writer().print("{x}", .{fallback_hash}) catch unreachable;
|
||||
defer fallback_version_file.close();
|
||||
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
b.install_path = output_dir;
|
||||
|
||||
exe.addLibPath("/usr/local/lib");
|
||||
exe.install();
|
||||
var javascript = b.addExecutable("spjs", "src/main_javascript.zig");
|
||||
var typings_exe = b.addExecutable("typescript-decls", "src/javascript/jsc/typescript.zig");
|
||||
javascript.setMainPkgPath(b.pathFromRoot("."));
|
||||
typings_exe.setMainPkgPath(b.pathFromRoot("."));
|
||||
exe.setMainPkgPath(b.pathFromRoot("."));
|
||||
|
||||
// exe.want_lto = true;
|
||||
if (!target.getCpuArch().isWasm()) {
|
||||
b.default_step.dependOn(&exe.step);
|
||||
|
||||
const bindings_dir = std.fs.path.join(
|
||||
b.allocator,
|
||||
&.{
|
||||
cwd,
|
||||
"src",
|
||||
"javascript",
|
||||
"jsc",
|
||||
"bindings-obj",
|
||||
},
|
||||
) catch unreachable;
|
||||
|
||||
var bindings_dir_ = cwd_dir.openDir(bindings_dir, .{ .iterate = true }) catch unreachable;
|
||||
var bindings_walker = bindings_dir_.walk(b.allocator) catch unreachable;
|
||||
|
||||
var bindings_files = std.ArrayList([]const u8).init(b.allocator);
|
||||
|
||||
while (bindings_walker.next() catch unreachable) |entry| {
|
||||
if (std.mem.eql(u8, std.fs.path.extension(entry.basename), ".o")) {
|
||||
bindings_files.append(bindings_dir_.realpathAlloc(b.allocator, entry.path) catch unreachable) catch unreachable;
|
||||
}
|
||||
}
|
||||
|
||||
// // References:
|
||||
// // - https://github.com/mceSystems/node-jsc/blob/master/deps/jscshim/webkit.gyp
|
||||
// // - https://github.com/mceSystems/node-jsc/blob/master/deps/jscshim/docs/webkit_fork_and_compilation.md#webkit-port-and-compilation
|
||||
// const flags = [_][]const u8{
|
||||
// "-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders",
|
||||
// "-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/WTF/Headers",
|
||||
// "-Isrc/javascript/jsc/WebKit/WebKitBuild/Release/ICU/Headers",
|
||||
// "-DSTATICALLY_LINKED_WITH_JavaScriptCore=1",
|
||||
// "-DSTATICALLY_LINKED_WITH_WTF=1",
|
||||
// "-DBUILDING_WITH_CMAKE=1",
|
||||
// "-DNOMINMAX",
|
||||
// "-DENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0",
|
||||
// "-DBUILDING_JSCONLY__",
|
||||
// "-DASSERT_ENABLED=0", // missing symbol errors like this will happen "JSC::DFG::DoesGCCheck::verifyCanGC(JSC::VM&)"
|
||||
// "-Isrc/JavaScript/jsc/WebKit/WebKitBuild/Release/", // config.h,
|
||||
// "-Isrc/JavaScript/jsc/bindings/",
|
||||
// "-Isrc/javascript/jsc/WebKit/Source/bmalloc",
|
||||
// "-std=gnu++17",
|
||||
// if (target.getOsTag() == .macos) "-DUSE_FOUNDATION=1" else "",
|
||||
// if (target.getOsTag() == .macos) "-DUSE_CF_RETAIN_PTR=1" else "",
|
||||
// };
|
||||
const headers_step = b.step("headers", "JSC headers");
|
||||
var headers_exec: *std.build.LibExeObjStep = b.addExecutable("headers", "src/javascript/jsc/bindings/bindings-generator.zig");
|
||||
var headers_runner = headers_exec.run();
|
||||
headers_exec.setMainPkgPath(javascript.main_pkg_path.?);
|
||||
headers_step.dependOn(&headers_runner.step);
|
||||
var translate_c: *std.build.TranslateCStep = b.addTranslateC(.{ .path = b.pathFromRoot("src/javascript/jsc/bindings/headers.h") });
|
||||
translate_c.out_basename = "headers";
|
||||
translate_c.output_dir = b.pathFromRoot("src/javascript/jsc/bindings/");
|
||||
headers_step.dependOn(&translate_c.step);
|
||||
headers_zig_file = b.pathFromRoot("src/javascript/jsc/bindings/headers.zig");
|
||||
|
||||
original_make_fn = headers_step.makeFn;
|
||||
headers_step.makeFn = HeadersMaker.make;
|
||||
b.default_step.dependOn(&exe.step);
|
||||
var steps = [_]*std.build.LibExeObjStep{ exe, javascript, typings_exe, headers_exec };
|
||||
|
||||
// const single_threaded = b.option(bool, "single-threaded", "Build single-threaded") orelse false;
|
||||
|
||||
for (steps) |step, i| {
|
||||
step.linkLibC();
|
||||
step.linkLibCpp();
|
||||
addPicoHTTP(
|
||||
step,
|
||||
true,
|
||||
);
|
||||
|
||||
step.addObjectFile("src/deps/libJavaScriptCore.a");
|
||||
step.addObjectFile("src/deps/libWTF.a");
|
||||
step.addObjectFile("src/deps/libbmalloc.a");
|
||||
|
||||
step.addObjectFile("src/deps/mimalloc/libmimalloc.a");
|
||||
step.addLibPath("src/deps/mimalloc");
|
||||
step.addIncludeDir("src/deps/mimalloc");
|
||||
|
||||
// step.single_threaded = single_threaded;
|
||||
|
||||
if (target.getOsTag() == .macos) {
|
||||
const homebrew_prefix = comptime if (std.Target.current.cpu.arch == .aarch64)
|
||||
"/opt/homebrew/"
|
||||
else
|
||||
"/usr/local/";
|
||||
|
||||
// We must link ICU statically
|
||||
step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicudata.a");
|
||||
step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicui18n.a");
|
||||
step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicuuc.a");
|
||||
// icucore is a weird macOS only library
|
||||
step.linkSystemLibrary("icucore");
|
||||
step.addLibPath(homebrew_prefix ++ "opt/icu4c/lib");
|
||||
step.addIncludeDir(homebrew_prefix ++ "opt/icu4c/include");
|
||||
}
|
||||
|
||||
for (bindings_files.items) |binding| {
|
||||
step.addObjectFile(
|
||||
binding,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var obj_step = b.step("obj", "Build Bun as a .o file");
|
||||
var obj = b.addObject(bun_executable_name, exe.root_src.?.path);
|
||||
obj.bundle_compiler_rt = true;
|
||||
addPicoHTTP(obj, false);
|
||||
obj.addPackage(.{
|
||||
.name = "clap",
|
||||
.path = .{ .path = "src/deps/zig-clap/clap.zig" },
|
||||
});
|
||||
|
||||
obj_step.dependOn(&obj.step);
|
||||
obj.setOutputDir(output_dir);
|
||||
obj.setBuildMode(mode);
|
||||
obj.setTarget(target);
|
||||
} else {
|
||||
b.default_step.dependOn(&exe.step);
|
||||
}
|
||||
|
||||
javascript.strip = false;
|
||||
javascript.packages = std.ArrayList(std.build.Pkg).fromOwnedSlice(b.allocator, b.allocator.dupe(std.build.Pkg, exe.packages.items) catch unreachable);
|
||||
|
||||
javascript.setOutputDir(output_dir);
|
||||
javascript.setBuildMode(mode);
|
||||
|
||||
const run_cmd = exe.run();
|
||||
run_cmd.step.dependOn(b.getInstallStep());
|
||||
@@ -32,4 +301,81 @@ pub fn build(b: *std.build.Builder) void {
|
||||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
var log_step = b.addLog("Destination: {s}/{s}\n", .{ output_dir, bun_executable_name });
|
||||
log_step.step.dependOn(&exe.step);
|
||||
|
||||
var typings_cmd: *std.build.RunStep = typings_exe.run();
|
||||
typings_cmd.cwd = cwd;
|
||||
typings_cmd.addArg(cwd);
|
||||
typings_cmd.addArg("types");
|
||||
typings_cmd.step.dependOn(&typings_exe.step);
|
||||
|
||||
typings_exe.linkLibC();
|
||||
typings_exe.linkLibCpp();
|
||||
typings_exe.setMainPkgPath(cwd);
|
||||
|
||||
var typings_step = b.step("types", "Build TypeScript types");
|
||||
typings_step.dependOn(&typings_cmd.step);
|
||||
|
||||
var javascript_cmd = b.step("spjs", "Build standalone JavaScript runtime. Must run \"make jsc\" first.");
|
||||
javascript_cmd.dependOn(&javascript.step);
|
||||
}
|
||||
|
||||
pub var original_make_fn: ?fn (step: *std.build.Step) anyerror!void = null;
|
||||
pub var headers_zig_file: ?[]const u8 = null;
|
||||
const HeadersMaker = struct {
|
||||
pub fn make(self: *std.build.Step) anyerror!void {
|
||||
try original_make_fn.?(self);
|
||||
var headers_zig: std.fs.File = try std.fs.openFileAbsolute(headers_zig_file.?, .{ .write = true });
|
||||
var contents = try headers_zig.readToEndAlloc(std.heap.page_allocator, headers_zig.getEndPos() catch unreachable);
|
||||
const last_extern_i = std.mem.lastIndexOf(u8, contents, "pub extern fn") orelse @panic("Expected contents");
|
||||
const last_newline = std.mem.indexOf(u8, contents[last_extern_i..], "\n") orelse @panic("Expected newline");
|
||||
const to_splice = "usingnamespace @import(\"./headers-replacements.zig\");\n";
|
||||
var new_contents = try std.heap.page_allocator.alloc(u8, contents.len + to_splice.len);
|
||||
std.mem.copy(u8, new_contents, to_splice);
|
||||
std.mem.copy(u8, new_contents[to_splice.len..], contents);
|
||||
var i: usize = to_splice.len;
|
||||
var remainder = new_contents[i..];
|
||||
while (remainder.len > 0) {
|
||||
i = std.mem.indexOf(u8, remainder, "\npub const struct_b") orelse break + "\npub const struct_b".len;
|
||||
var begin = remainder[i..];
|
||||
const end_line = std.mem.indexOf(u8, begin, "extern struct {") orelse break;
|
||||
const end_struct = std.mem.indexOf(u8, begin, "\n};\n") orelse break + "\n};\n".len;
|
||||
|
||||
std.mem.set(u8, begin[1 .. end_struct + 3], ' ');
|
||||
remainder = begin[end_struct..];
|
||||
}
|
||||
i = to_splice.len;
|
||||
remainder = new_contents[i..];
|
||||
while (remainder.len > 0) {
|
||||
i = std.mem.indexOf(u8, remainder, "\npub const struct_") orelse break + "\npub const struct_".len;
|
||||
var begin = remainder[i..];
|
||||
var end_struct = std.mem.indexOf(u8, begin, "opaque {};") orelse break;
|
||||
end_struct += std.mem.indexOf(u8, begin[end_struct..], "\n") orelse break;
|
||||
i = 0;
|
||||
|
||||
std.mem.set(u8, begin[1..end_struct], ' ');
|
||||
remainder = begin[end_struct..];
|
||||
}
|
||||
|
||||
const HARDCODE = [_][]const u8{
|
||||
"[*c][*c]JSC__Exception",
|
||||
"*?*JSC__Exception ",
|
||||
"[*c]?*c_void",
|
||||
"[*c]*c_void",
|
||||
};
|
||||
i = 0;
|
||||
while (i < HARDCODE.len) : (i += 2) {
|
||||
_ = std.mem.replace(u8, new_contents, HARDCODE[i], HARDCODE[i + 1], new_contents);
|
||||
}
|
||||
|
||||
const js_value_start = std.mem.indexOf(u8, new_contents, "pub const JSC__JSValue") orelse unreachable;
|
||||
const js_value_end = std.mem.indexOf(u8, new_contents[js_value_start..], "\n") orelse unreachable;
|
||||
std.mem.set(u8, new_contents[js_value_start..][0..js_value_end], ' ');
|
||||
|
||||
try headers_zig.seekTo(0);
|
||||
try headers_zig.writeAll(new_contents);
|
||||
try headers_zig.setEndPos(last_newline + last_extern_i + to_splice.len);
|
||||
}
|
||||
};
|
||||
|
||||
14
entitlements.plist
Normal file
14
entitlements.plist
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
15
examples/css-stress-test/index.html
Normal file
15
examples/css-stress-test/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
crossorigin="anonymous"
|
||||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"
|
||||
/>
|
||||
<link rel="stylesheet" href="src/index.css" />
|
||||
<script async src="src/index.tsx" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="reactroot"></div>
|
||||
</body>
|
||||
</html>
|
||||
2
examples/css-stress-test/inject.js
Normal file
2
examples/css-stress-test/inject.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import React from "react";
|
||||
export { React };
|
||||
6
examples/css-stress-test/next-env.d.ts
vendored
Normal file
6
examples/css-stress-test/next-env.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/types/global" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
37
examples/css-stress-test/package.json
Normal file
37
examples/css-stress-test/package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "simple-react",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@emotion/css": "^11.1.3",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.3",
|
||||
"antd": "^4.16.1",
|
||||
"left-pad": "^1.3.0",
|
||||
"next": "^11.0.1",
|
||||
"parcel": "2.0.0-beta.3",
|
||||
"path-browserify": "^1.0.1",
|
||||
"react": "^17.0.2",
|
||||
"react-bootstrap": "^1.6.1",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-form": "^4.0.1",
|
||||
"react-hook-form": "^7.8.3",
|
||||
"url": "^0.11.0",
|
||||
"wipwipwipwip-next-donotuse": "4.0.0"
|
||||
},
|
||||
"parcel": "parceldist/index.js",
|
||||
"targets": {
|
||||
"parcel": {
|
||||
"outputFormat": "esmodule",
|
||||
"sourceMap": false,
|
||||
"optimize": false,
|
||||
"engines": {
|
||||
"chrome": "last 1 version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/fetch-event-source": "^2.0.1",
|
||||
"@snowpack/plugin-react-refresh": "^2.5.0",
|
||||
"typescript": "^4.3.4"
|
||||
}
|
||||
}
|
||||
11
examples/css-stress-test/pages/[id]/boom.tsx
Normal file
11
examples/css-stress-test/pages/[id]/boom.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Main } from "../../src/main";
|
||||
|
||||
function IndexRoute() {
|
||||
return (
|
||||
<div>
|
||||
<Main productName={"Boom id"} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { IndexRoute as default };
|
||||
12
examples/css-stress-test/pages/_app.tsx
Normal file
12
examples/css-stress-test/pages/_app.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
// import "../src/index.css";
|
||||
|
||||
import App from "next/app";
|
||||
|
||||
class MyApp extends App {
|
||||
render() {
|
||||
const { Component, pageProps } = this.props;
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default MyApp;
|
||||
7
examples/css-stress-test/pages/index.tsx
Normal file
7
examples/css-stress-test/pages/index.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Main } from "src/main";
|
||||
|
||||
export function IndexPage() {
|
||||
return <Main />;
|
||||
}
|
||||
|
||||
export default IndexPage;
|
||||
9
examples/css-stress-test/pages/plain/nested.tsx
Normal file
9
examples/css-stress-test/pages/plain/nested.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Main } from "../../src/main";
|
||||
|
||||
export default function IndexRoute() {
|
||||
return (
|
||||
<div>
|
||||
<Main productName={"nested!"} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
13
examples/css-stress-test/pages/two.tsx
Normal file
13
examples/css-stress-test/pages/two.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Main } from "../src/main";
|
||||
|
||||
export function getInitialProps() {
|
||||
return {};
|
||||
}
|
||||
|
||||
export default function IndexRoute() {
|
||||
return (
|
||||
<div>
|
||||
<Main productName={"Page 2! Next.js (Webpack 5)"} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
1
examples/css-stress-test/react-inject.js
vendored
Normal file
1
examples/css-stress-test/react-inject.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default as React } from "react";
|
||||
21
examples/css-stress-test/snowpack.config.js
Normal file
21
examples/css-stress-test/snowpack.config.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// Snowpack Configuration File
|
||||
// See all supported options: https://www.snowpack.dev/reference/configuration
|
||||
|
||||
/** @type {import("snowpack").SnowpackUserConfig } */
|
||||
module.exports = {
|
||||
root: "src",
|
||||
mount: {
|
||||
public: "/",
|
||||
src: "/",
|
||||
},
|
||||
plugins: ["@snowpack/plugin-react-refresh"],
|
||||
packageOptions: {
|
||||
/* ... */
|
||||
},
|
||||
devOptions: {
|
||||
/* ... */
|
||||
},
|
||||
buildOptions: {
|
||||
/* ... */
|
||||
},
|
||||
};
|
||||
11758
examples/css-stress-test/src/button.css
Normal file
11758
examples/css-stress-test/src/button.css
Normal file
File diff suppressed because it is too large
Load Diff
1
examples/css-stress-test/src/button.tsx
Normal file
1
examples/css-stress-test/src/button.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export const Button = ({ children }) => <div>asdasasd{children}</div>;
|
||||
14
examples/css-stress-test/src/colors.css
Normal file
14
examples/css-stress-test/src/colors.css
Normal file
@@ -0,0 +1,14 @@
|
||||
:root {
|
||||
--timestamp: "596";
|
||||
--interval: "64";
|
||||
--progress-bar: 33.167%;
|
||||
--spinner-1-muted: rgb(42, 74, 66);
|
||||
--spinner-1-primary: rgb(53, 93, 82);
|
||||
--spinner-2-muted: rgb(90, 51, 192);
|
||||
--spinner-2-primary: rgb(112, 64, 240);
|
||||
--spinner-3-muted: rgb(157, 140, 68);
|
||||
--spinner-3-primary: rgb(196, 175, 85);
|
||||
--spinner-4-muted: rgb(86, 152, 66);
|
||||
--spinner-4-primary: rgb(108, 190, 82);
|
||||
--spinner-rotate: 237deg;
|
||||
}
|
||||
3
examples/css-stress-test/src/colors2.css
Normal file
3
examples/css-stress-test/src/colors2.css
Normal file
@@ -0,0 +1,3 @@
|
||||
body {
|
||||
filter: sepia(50%) brightness(200%);
|
||||
}
|
||||
27
examples/css-stress-test/src/components/button.tsx
Normal file
27
examples/css-stress-test/src/components/button.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from "react";
|
||||
import { NewComponent } from "./new-comp";
|
||||
|
||||
const Toast = () => {
|
||||
const [baconyes, baconno] = useBacon();
|
||||
return <div>false</div>;
|
||||
};
|
||||
const Button = ({ label, label2, onClick }) => {
|
||||
const useCustomHookInsideFunction = (what, arr) => {
|
||||
return [true, false];
|
||||
};
|
||||
const [on, setOn] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log({ on });
|
||||
}, [on]);
|
||||
|
||||
// const [foo1, foo2] = useCustomHookInsideFunction(() => {}, [on]);
|
||||
|
||||
return (
|
||||
<div className="Button" onClick={onClick}>
|
||||
<Toast>f</Toast>
|
||||
<div className="Button-label">{label}12</div>
|
||||
<NewComponent />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
3
examples/css-stress-test/src/components/new-comp.tsx
Normal file
3
examples/css-stress-test/src/components/new-comp.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export const NewComponent = () => {
|
||||
return <div>NEW!</div>;
|
||||
};
|
||||
1
examples/css-stress-test/src/font.css
Normal file
1
examples/css-stress-test/src/font.css
Normal file
@@ -0,0 +1 @@
|
||||
/* @import "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"; */
|
||||
237
examples/css-stress-test/src/index.css
Normal file
237
examples/css-stress-test/src/index.css
Normal file
@@ -0,0 +1,237 @@
|
||||
@import "./colors.css";
|
||||
|
||||
:root {
|
||||
--heading-font: "Space Mono", system-ui;
|
||||
--body-font: "IBM Plex Sans", system-ui;
|
||||
|
||||
--color-brand: #02ff00;
|
||||
--color-brand-muted: rgb(2, 150, 0);
|
||||
|
||||
--padding-horizontal: 90px;
|
||||
|
||||
--page-background: black;
|
||||
--page-background-alpha: rgba(0, 0, 0, 0.8);
|
||||
|
||||
--result__background-color: black;
|
||||
--result__primary-color: var(--color-brand);
|
||||
--result__foreground-color: white;
|
||||
--result__muted-color: rgb(165, 165, 165);
|
||||
|
||||
--card-width: 352px;
|
||||
|
||||
--page-width: 1152px;
|
||||
|
||||
--snippets_container-background-unfocused: #171717;
|
||||
--snippets_container-background-focused: #0017e9;
|
||||
--snippets_container-background: var(
|
||||
--snippets_container-background-unfocused
|
||||
);
|
||||
--snippets_container-muted-color: rgb(153, 153, 153);
|
||||
}
|
||||
|
||||
body {
|
||||
color: white;
|
||||
margin: 0;
|
||||
|
||||
padding: 0;
|
||||
font-family: var(--body-font);
|
||||
background-color: var(--page-background);
|
||||
color: var(--result__muted-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.Subtitle {
|
||||
text-align: center;
|
||||
font-size: 4em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin-bottom: 0.25em;
|
||||
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
#reactroot,
|
||||
#__next,
|
||||
body,
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.Title {
|
||||
color: var(--color-brand);
|
||||
font-family: var(--heading-font);
|
||||
font-weight: 700;
|
||||
margin-top: 48px;
|
||||
font-size: 48px;
|
||||
text-transform: capitalize;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.Description {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
header,
|
||||
.main {
|
||||
width: 650px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
section {
|
||||
width: 650px;
|
||||
}
|
||||
|
||||
header {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
footer {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
#reactroot,
|
||||
#__next {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
section {
|
||||
height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.timer {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.ProgressBar-container {
|
||||
width: 100%;
|
||||
display: block;
|
||||
position: relative;
|
||||
border: 1px solid var(--color-brand-muted);
|
||||
border-radius: 4px;
|
||||
|
||||
height: 92px;
|
||||
}
|
||||
|
||||
.ProgressBar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background-color: var(--color-brand);
|
||||
transform-origin: top left;
|
||||
border-radius: 4px;
|
||||
transform: scaleX(var(--progress-bar, 0%));
|
||||
}
|
||||
|
||||
.Bundler-container {
|
||||
background-color: var(--snippets_container-background-focused);
|
||||
font-size: 64px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 0.8em 0.8em;
|
||||
}
|
||||
|
||||
.Bundler-updateRate {
|
||||
font-size: 0.8em;
|
||||
font-weight: normal;
|
||||
display: flex;
|
||||
color: var(--result__muted-color);
|
||||
}
|
||||
|
||||
.interval:before {
|
||||
content: var(--interval, "16");
|
||||
}
|
||||
|
||||
.highlight {
|
||||
margin-left: 0.5ch;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.timer:after {
|
||||
content: var(--timestamp);
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
display: inline;
|
||||
font-weight: 500;
|
||||
color: white;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.SectionLabel {
|
||||
font-weight: 300;
|
||||
font-family: var(--heading-font);
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
font-weight: 700;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.FooterLabel {
|
||||
margin-top: 0;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.Spinner-container {
|
||||
--spinner-muted: rgb(0, 255, 0);
|
||||
--spinner-primary: rgb(0, 60, 255);
|
||||
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--page-background);
|
||||
border-top: 1.1em solid var(--spinner-muted);
|
||||
border-right: 1.1em solid var(--spinner-muted);
|
||||
border-bottom: 1.1em solid var(--spinner-muted);
|
||||
border-left: 1.1em solid var(--spinner-primary);
|
||||
|
||||
transform: rotate(var(--spinner-rotate, 12deg));
|
||||
}
|
||||
|
||||
.Spinners {
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
justify-content: space-between;
|
||||
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.Spinner-1.Spinner-container {
|
||||
--spinner-muted: var(--spinner-1-muted);
|
||||
--spinner-primary: var(--spinner-1-primary);
|
||||
}
|
||||
|
||||
.Spinner-2.Spinner-container {
|
||||
--spinner-muted: var(--spinner-2-muted);
|
||||
--spinner-primary: var(--spinner-2-primary);
|
||||
}
|
||||
|
||||
.Spinner-3.Spinner-container {
|
||||
--spinner-muted: var(--spinner-3-muted);
|
||||
--spinner-primary: var(--spinner-3-primary);
|
||||
}
|
||||
|
||||
.Spinner-4.Spinner-container {
|
||||
--spinner-muted: var(--spinner-4-muted);
|
||||
--spinner-primary: var(--spinner-4-primary);
|
||||
}
|
||||
25
examples/css-stress-test/src/index.tsx
Normal file
25
examples/css-stress-test/src/index.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Main } from "./main";
|
||||
import classNames from "classnames";
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
const Base = ({}) => {
|
||||
const name =
|
||||
typeof location !== "undefined"
|
||||
? decodeURIComponent(location.search.substring(1))
|
||||
: null;
|
||||
return <Main productName={name || "asdasdasdasdasdasd"} />;
|
||||
};
|
||||
|
||||
function startReact() {
|
||||
ReactDOM.hydrate(<Base />, document.querySelector("#reactroot"));
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
globalThis.addEventListener("DOMContentLoaded", () => {
|
||||
startReact();
|
||||
});
|
||||
|
||||
startReact();
|
||||
}
|
||||
|
||||
export { Base };
|
||||
67
examples/css-stress-test/src/main.tsx
Normal file
67
examples/css-stress-test/src/main.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
export const Main = ({ productName }) => {
|
||||
return (
|
||||
<>
|
||||
<header>
|
||||
<div className="Title">CSS HMR Stress Test!</div>
|
||||
<p className="Description">
|
||||
This page visually tests how quickly a bundler can update CSS over Hot
|
||||
Module Reloading.
|
||||
</p>
|
||||
</header>
|
||||
<main className="main">
|
||||
<section className="ProgressSection">
|
||||
<p className="Subtitle">
|
||||
<span className="Subtitle-part">
|
||||
Ran: <span className="timer"></span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div className="ProgressBar-container">
|
||||
<div className="ProgressBar"></div>
|
||||
</div>
|
||||
<div className="SectionLabel">
|
||||
The progress bar should move from left to right smoothly.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div className="Spinners">
|
||||
<div className="Spinner-container Spinner-1">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-2">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-3">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-4">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="SectionLabel">
|
||||
The spinners should rotate & change color smoothly.
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<div className="SectionLabel FooterLabel">
|
||||
There are no CSS animations on this page.
|
||||
</div>
|
||||
|
||||
<div className="Bundler-container">
|
||||
<div className="Bundler">{productName}</div>
|
||||
<div className="Bundler-updateRate">
|
||||
{/* This should loose all the styles
|
||||
<span className="highlight">
|
||||
<span className="interval"></span>ms
|
||||
</span> */}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
1
examples/css-stress-test/test-pnpm.js
Normal file
1
examples/css-stress-test/test-pnpm.js
Normal file
@@ -0,0 +1 @@
|
||||
import jsx from "/Users/jarred/Code/bun/demos/css-stress-test/node_modules/react/cjs/react-jsx-dev-runtime.development.js";
|
||||
23
examples/css-stress-test/tsconfig.json
Normal file
23
examples/css-stress-test/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"lib": ["dom", "dom.iterable", "esnext", "WebWorker"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"path": ["node_modules/path-browserify"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
5
examples/css-stress-test/vite.config.js
Normal file
5
examples/css-stress-test/vite.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import reactRefresh from "@vitejs/plugin-react-refresh";
|
||||
|
||||
export default {
|
||||
plugins: [reactRefresh()],
|
||||
};
|
||||
23
examples/hello-create-react-app/.gitignore
vendored
Normal file
23
examples/hello-create-react-app/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
70
examples/hello-create-react-app/README.md
Normal file
70
examples/hello-create-react-app/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.\
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `yarn build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||
41
examples/hello-create-react-app/package.json
Normal file
41
examples/hello-create-react-app/package.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "hello-create-react-app",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "4.0.3",
|
||||
"web-vitals": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.4.2"
|
||||
}
|
||||
}
|
||||
BIN
examples/hello-create-react-app/public/favicon.ico
Normal file
BIN
examples/hello-create-react-app/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
44
examples/hello-create-react-app/public/index.html
Normal file
44
examples/hello-create-react-app/public/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script src="/src/index.jsx" async type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
examples/hello-create-react-app/public/logo192.png
Normal file
BIN
examples/hello-create-react-app/public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
examples/hello-create-react-app/public/logo512.png
Normal file
BIN
examples/hello-create-react-app/public/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
examples/hello-create-react-app/public/manifest.json
Normal file
25
examples/hello-create-react-app/public/manifest.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
examples/hello-create-react-app/public/robots.txt
Normal file
3
examples/hello-create-react-app/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
38
examples/hello-create-react-app/src/App.css
Normal file
38
examples/hello-create-react-app/src/App.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
25
examples/hello-create-react-app/src/App.jsx
Normal file
25
examples/hello-create-react-app/src/App.jsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import logo from "./logo.svg";
|
||||
import * as React from "react";
|
||||
import "./App.css";
|
||||
|
||||
function App() {
|
||||
const ms = Date.now() - parseInt(window.location.search.substring(1), 10);
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<h3>Loaded in {ms}ms.</h3>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
8
examples/hello-create-react-app/src/App.test.js
Normal file
8
examples/hello-create-react-app/src/App.test.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
13
examples/hello-create-react-app/src/index.css
Normal file
13
examples/hello-create-react-app/src/index.css
Normal file
@@ -0,0 +1,13 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
17
examples/hello-create-react-app/src/index.jsx
Normal file
17
examples/hello-create-react-app/src/index.jsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById("root")
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
1
examples/hello-create-react-app/src/logo.svg
Normal file
1
examples/hello-create-react-app/src/logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
13
examples/hello-create-react-app/src/reportWebVitals.js
Normal file
13
examples/hello-create-react-app/src/reportWebVitals.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
5
examples/hello-create-react-app/src/setupTests.js
Normal file
5
examples/hello-create-react-app/src/setupTests.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
3
examples/hello-next/.eslintrc.json
Normal file
3
examples/hello-next/.eslintrc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
||||
34
examples/hello-next/.gitignore
vendored
Normal file
34
examples/hello-next/.gitignore
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
34
examples/hello-next/README.md
Normal file
34
examples/hello-next/README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
||||
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
13
examples/hello-next/components/Title.tsx
Normal file
13
examples/hello-next/components/Title.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import Hey from "./subtitle";
|
||||
|
||||
export default function Title() {
|
||||
return (
|
||||
<h1>
|
||||
Hello <Hey></Hey>
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
export enum TitleEnum {
|
||||
wow = 1,
|
||||
}
|
||||
4
examples/hello-next/components/subtitle.tsx
Normal file
4
examples/hello-next/components/subtitle.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
export default function Hey() {
|
||||
return <div>!!yep</div>;
|
||||
}
|
||||
1
examples/hello-next/components/wow/such-path.ts
Normal file
1
examples/hello-next/components/wow/such-path.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const yep = true;
|
||||
6
examples/hello-next/next-env.d.ts
vendored
Normal file
6
examples/hello-next/next-env.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/types/global" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
10
examples/hello-next/next.config.js
Normal file
10
examples/hello-next/next.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
reactStrictMode: true,
|
||||
typescript: {
|
||||
// !! WARN !!
|
||||
// Dangerously allow production builds to successfully complete even if
|
||||
// your project has type errors.
|
||||
// !! WARN !!
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
};
|
||||
18014
examples/hello-next/package-lock.json
generated
Normal file
18014
examples/hello-next/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
examples/hello-next/package.json
Normal file
25
examples/hello-next/package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "hello-next",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jarred/react-static-tweets": "0.5.8",
|
||||
"@jarred/static-tweets": "^0.5.8",
|
||||
"date-fns": "^2.23.0",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"next": "^11.1.0",
|
||||
"parcel": "2.0.0-rc.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-is": "^17.0.2",
|
||||
"whatwg-url": "^9.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/standalone": "^7.15.3",
|
||||
"@types/react": "^17.0.19",
|
||||
"bun-framework-next": "^0.0.0-21",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
7
examples/hello-next/pages/_app.tsx
Normal file
7
examples/hello-next/pages/_app.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import "../styles/globals.css";
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
|
||||
export default MyApp;
|
||||
5
examples/hello-next/pages/api/hello.tsx
Normal file
5
examples/hello-next/pages/api/hello.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
|
||||
export default function handler(req, res) {
|
||||
res.status(200).json({ name: 'John Doe' })
|
||||
}
|
||||
26
examples/hello-next/pages/foo/bar/third.tsx
Normal file
26
examples/hello-next/pages/foo/bar/third.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export default function Baz({}) {
|
||||
return (
|
||||
<div style={{ padding: 16 }}>
|
||||
<h1>Third</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<Link href="/">
|
||||
<a>Root page</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/second">
|
||||
<a>Second page</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/posts/123">
|
||||
<a>Post page 123</a>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
82
examples/hello-next/pages/index.tsx
Normal file
82
examples/hello-next/pages/index.tsx
Normal file
@@ -0,0 +1,82 @@
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import React from "react";
|
||||
import styles from "../styles/Home.module.css";
|
||||
|
||||
export async function getStaticProps(ctx) {
|
||||
return {
|
||||
props: {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function Home({ }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<title>Fo</title>
|
||||
<meta name="description" content="Generated by create next app" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
|
||||
<main className={styles.main}>
|
||||
<h1 className={styles.title}>
|
||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
||||
</h1>
|
||||
|
||||
<p className={styles.description}>
|
||||
Get started by editing{" "}
|
||||
<code className={styles.code}>pages/index.js</code>
|
||||
</p>
|
||||
|
||||
<div className={styles.grid}>
|
||||
<Link href="/second">
|
||||
<div className={styles.card}>
|
||||
<h2>Second Page →</h2>
|
||||
<p>Link</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
<a
|
||||
onClick={() => router.push("/foo/bar/third")}
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Third Page →</h2>
|
||||
<p>button, router.push()</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://github.com/vercel/next.js/tree/master/examples"
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Examples →</h2>
|
||||
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
className={styles.card}
|
||||
>
|
||||
<h2>Deploy →</h2>
|
||||
<p>
|
||||
Instantly deploy your Next.js site to a public URL with Vercel.
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer className={styles.footer}>
|
||||
<a
|
||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Powered by{" "}
|
||||
<span className={styles.logo}>
|
||||
<img src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
|
||||
</span>
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
19
examples/hello-next/pages/posts/[id].tsx
Normal file
19
examples/hello-next/pages/posts/[id].tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useRouter } from "next/router";
|
||||
import Link from "next/link";
|
||||
|
||||
export default function Post({}) {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<div style={{ padding: 16 }}>
|
||||
<h1>Post: {router.query.id}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<Link href="/">
|
||||
<a>Root page</a>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
22
examples/hello-next/pages/second.tsx
Normal file
22
examples/hello-next/pages/second.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export default function Second({}) {
|
||||
return (
|
||||
<div style={{ padding: 16 }}>
|
||||
<h1>Second</h1>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<Link href="/">
|
||||
<a>Root page</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/foo/bar/third">
|
||||
<a>Third! page</a>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
BIN
examples/hello-next/public/favicon.ico
Normal file
BIN
examples/hello-next/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
4
examples/hello-next/public/vercel.svg
Normal file
4
examples/hello-next/public/vercel.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
0
examples/hello-next/styles/2.css
Normal file
0
examples/hello-next/styles/2.css
Normal file
121
examples/hello-next/styles/Home.module.css
Normal file
121
examples/hello-next/styles/Home.module.css
Normal file
@@ -0,0 +1,121 @@
|
||||
@import url("./2.css");
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
padding: 0 0.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
.main {
|
||||
padding: 5rem 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
border-top: 1px solid #eaeaea;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.title a {
|
||||
color: #0070f3;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.title a:hover,
|
||||
.title a:focus,
|
||||
.title a:active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0;
|
||||
line-height: 1.15;
|
||||
font-size: 4rem;
|
||||
}
|
||||
|
||||
.title,
|
||||
.description {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.description {
|
||||
line-height: 1.5;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.code {
|
||||
background: #fafafa;
|
||||
border-radius: 5px;
|
||||
padding: 0.75rem;
|
||||
font-size: 1.1rem;
|
||||
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
|
||||
Bitstream Vera Sans Mono, Courier New, monospace;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
max-width: 800px;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin: 1rem;
|
||||
padding: 1.5rem;
|
||||
text-align: left;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
border: 1px solid #eaeaea;
|
||||
border-radius: 10px;
|
||||
transition: color 0.15s ease, border-color 0.15s ease;
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.card:hover,
|
||||
.card:focus,
|
||||
.card:active {
|
||||
color: #0070f3;
|
||||
border-color: #0070f3;
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
margin: 0 0 1rem 0;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.card p {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 1em;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.grid {
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
21
examples/hello-next/styles/globals.css
Normal file
21
examples/hello-next/styles/globals.css
Normal file
@@ -0,0 +1,21 @@
|
||||
html,
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image: url(https://wompampsupport.azureedge.net/fetchimage?siteId=7575&v=2&jpgQuality=100&width=700&url=https%3A%2F%2Fi.kym-cdn.com%2Fentries%2Ficons%2Foriginal%2F000%2F013%2F564%2Fdoge.jpg);
|
||||
background-size: cover;
|
||||
}
|
||||
21
examples/hello-next/tsconfig.json
Normal file
21
examples/hello-next/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"paths": {}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
11
examples/lotta-modules/index.js
Normal file
11
examples/lotta-modules/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import "three/three1";
|
||||
import "three/three2";
|
||||
import "three/three3";
|
||||
import "three/three4";
|
||||
import "three/three5";
|
||||
import "three/three6";
|
||||
import "three/three7";
|
||||
import "three/three8";
|
||||
import "three/three9";
|
||||
import "three/three10";
|
||||
// import "@babel/standalone/babel";
|
||||
11
examples/lotta-modules/package.json
Normal file
11
examples/lotta-modules/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "lotta-modules",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/standalone": "^7.15.3",
|
||||
"lodash": "^4.17.21",
|
||||
"three.js": "^0.77.1",
|
||||
"underscore": "^1.13.1"
|
||||
}
|
||||
}
|
||||
6
examples/lotta-modules/public/index.html
Normal file
6
examples/lotta-modules/public/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<head> </head>
|
||||
<body>
|
||||
<script src="/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
33
examples/react-fast-refresh-test/package.json
Normal file
33
examples/react-fast-refresh-test/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "simple-react",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@emotion/css": "^11.1.3",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.3",
|
||||
"antd": "^4.16.1",
|
||||
"left-pad": "^1.3.0",
|
||||
"next": "^11.0.0",
|
||||
"parcel": "2.0.0-beta.3",
|
||||
"react": "^17.0.2",
|
||||
"react-bootstrap": "^1.6.1",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-form": "^4.0.1",
|
||||
"react-hook-form": "^7.8.3"
|
||||
},
|
||||
"parcel": "parceldist/index.js",
|
||||
"targets": {
|
||||
"parcel": {
|
||||
"outputFormat": "esmodule",
|
||||
"sourceMap": false,
|
||||
"optimize": false,
|
||||
"engines": {
|
||||
"chrome": "last 1 version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@snowpack/plugin-react-refresh": "^2.5.0",
|
||||
"typescript": "^4.3.4"
|
||||
}
|
||||
}
|
||||
15
examples/react-fast-refresh-test/public/index.html
Normal file
15
examples/react-fast-refresh-test/public/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
crossorigin="anonymous"
|
||||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="reactroot"></div>
|
||||
<link rel="stylesheet" href="./src/index.css" />
|
||||
<script src="./src/index.tsx" async type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
11758
examples/react-fast-refresh-test/src/button.css
Normal file
11758
examples/react-fast-refresh-test/src/button.css
Normal file
File diff suppressed because it is too large
Load Diff
14
examples/react-fast-refresh-test/src/colors.css
Normal file
14
examples/react-fast-refresh-test/src/colors.css
Normal file
@@ -0,0 +1,14 @@
|
||||
:root {
|
||||
--timestamp: "12812";
|
||||
--interval: "8";
|
||||
--progress-bar: 11.83299999999997%;
|
||||
--spinner-1-muted: rgb(142, 6, 182);
|
||||
--spinner-1-primary: rgb(177, 8, 227);
|
||||
--spinner-2-muted: rgb(110, 148, 190);
|
||||
--spinner-2-primary: rgb(138, 185, 238);
|
||||
--spinner-3-muted: rgb(75, 45, 64);
|
||||
--spinner-3-primary: rgb(94, 56, 80);
|
||||
--spinner-4-muted: rgb(155, 129, 108);
|
||||
--spinner-4-primary: rgb(194, 161, 135);
|
||||
--spinner-rotate: 213deg;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
|
||||
export function RenderCounter({ name, children }) {
|
||||
const counter = React.useRef(1);
|
||||
return (
|
||||
<div className="RenderCounter">
|
||||
<div className="RenderCounter-meta">
|
||||
<div className="RenderCounter-title">
|
||||
{name} rendered <strong>{counter.current++} times</strong>
|
||||
</div>
|
||||
<div className="RenderCounter-lastRender">
|
||||
LAST RENDER:{" "}
|
||||
{new Intl.DateTimeFormat([], {
|
||||
timeStyle: "long",
|
||||
}).format(new Date())}
|
||||
</div>
|
||||
</div>
|
||||
<div className="RenderCounter-children">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
14
examples/react-fast-refresh-test/src/components/app.tsx
Normal file
14
examples/react-fast-refresh-test/src/components/app.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from "react";
|
||||
import { Button } from "./Button";
|
||||
import { RenderCounter } from "./RenderCounter";
|
||||
export function App() {
|
||||
return (
|
||||
<RenderCounter name="App">
|
||||
<div className="AppRoot">
|
||||
<h1>This is the root element</h1>
|
||||
|
||||
<Button>Click</Button>
|
||||
</div>
|
||||
</RenderCounter>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { RenderCounter } from "./RenderCounter";
|
||||
|
||||
export const Button = ({ children }) => {
|
||||
return (
|
||||
<RenderCounter name="Button">
|
||||
<div className="Button">{children}</div>
|
||||
</RenderCounter>
|
||||
);
|
||||
};
|
||||
1
examples/react-fast-refresh-test/src/font.css
Normal file
1
examples/react-fast-refresh-test/src/font.css
Normal file
@@ -0,0 +1 @@
|
||||
@import "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap";
|
||||
98
examples/react-fast-refresh-test/src/index.css
Normal file
98
examples/react-fast-refresh-test/src/index.css
Normal file
@@ -0,0 +1,98 @@
|
||||
@import "./colors.css";
|
||||
|
||||
:root {
|
||||
--heading-font: "Space Mono", system-ui;
|
||||
--body-font: "IBM Plex Sans", system-ui;
|
||||
|
||||
--color-brand: #02ff00;
|
||||
--color-brand-muted: rgb(2, 150, 0);
|
||||
|
||||
--padding-horizontal: 90px;
|
||||
|
||||
--page-background: black;
|
||||
--page-background-alpha: rgba(0, 0, 0, 0.8);
|
||||
|
||||
--result__background-color: black;
|
||||
--result__primary-color: var(--color-brand);
|
||||
--result__foreground-color: white;
|
||||
--result__muted-color: rgb(165, 165, 165);
|
||||
|
||||
--card-width: 352px;
|
||||
|
||||
--page-width: 1152px;
|
||||
|
||||
--snippets_container-background-unfocused: #171717;
|
||||
--snippets_container-background-focused: #0017e9;
|
||||
--snippets_container-background: var(
|
||||
--snippets_container-background-unfocused
|
||||
);
|
||||
--snippets_container-muted-color: rgb(153, 153, 153);
|
||||
}
|
||||
|
||||
body {
|
||||
color: white;
|
||||
margin: 0;
|
||||
|
||||
padding: 0;
|
||||
font-family: var(--body-font);
|
||||
background-color: var(--page-background);
|
||||
color: var(--result__muted-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#reactroot,
|
||||
#__next,
|
||||
body,
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.RenderCounter {
|
||||
border: 10px solid var(--snippets_container-background-focused);
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
animation: flash 0.2s linear;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
.RenderCounter-meta {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin: -10px;
|
||||
padding: 10px;
|
||||
background-color: #111;
|
||||
}
|
||||
|
||||
.RenderCounter-lastRender,
|
||||
.RenderCounter-title {
|
||||
white-space: nowrap;
|
||||
color: rgb(153, 153, 153);
|
||||
}
|
||||
|
||||
@keyframes flash {
|
||||
from {
|
||||
border-color: var(--snippets_container-background-focused);
|
||||
}
|
||||
|
||||
to {
|
||||
border-color: var(--snippets_container-background-unfocused);
|
||||
}
|
||||
}
|
||||
|
||||
.Button {
|
||||
display: block;
|
||||
|
||||
border: 1px solid rgb(20, 180, 0);
|
||||
background-color: rgb(2, 150, 0);
|
||||
color: white;
|
||||
font-weight: 500;
|
||||
padding: 10px 12px;
|
||||
border-radius: 4px;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
width: fit-content;
|
||||
cursor: pointer;
|
||||
}
|
||||
15
examples/react-fast-refresh-test/src/index.tsx
Normal file
15
examples/react-fast-refresh-test/src/index.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import ReactDOM from "react-dom";
|
||||
import React from "react";
|
||||
import { App } from "./components/app";
|
||||
import classNames from "classnames";
|
||||
|
||||
function startReact() {
|
||||
ReactDOM.render(<App />, document.querySelector("#reactroot"));
|
||||
}
|
||||
|
||||
globalThis.addEventListener("DOMContentLoaded", () => {
|
||||
startReact();
|
||||
});
|
||||
startReact();
|
||||
|
||||
export { App };
|
||||
69
examples/react-fast-refresh-test/src/main.tsx
Normal file
69
examples/react-fast-refresh-test/src/main.tsx
Normal file
@@ -0,0 +1,69 @@
|
||||
import React from "react";
|
||||
|
||||
export const Main = ({ productName }) => {
|
||||
return (
|
||||
<>
|
||||
<header>
|
||||
<div className="Title">CSS HMR Stress Test</div>
|
||||
<p className="Description">
|
||||
This page visually tests how quickly a bundler can update CSS over Hot
|
||||
Module Reloading.
|
||||
</p>
|
||||
</header>
|
||||
<main className="main">
|
||||
<section className="ProgressSection">
|
||||
<p className="Subtitle">
|
||||
<span className="Subtitle-part">
|
||||
Ran: <span className="timer"></span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div className="ProgressBar-container">
|
||||
<div className="ProgressBar"></div>
|
||||
</div>
|
||||
<div className="SectionLabel">
|
||||
The progress bar should move from left to right smoothly.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div className="Spinners">
|
||||
<div className="Spinner-container Spinner-1">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-2">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-3">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-4">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="SectionLabel">
|
||||
The spinners should rotate & change color smoothly.
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<div className="SectionLabel FooterLabel">
|
||||
There are no CSS animations on this page.
|
||||
</div>
|
||||
|
||||
<div className="Bundler-container">
|
||||
<div className="Bundler">{productName}</div>
|
||||
<div className="Bundler-updateRate">
|
||||
Saving a css file every
|
||||
<span className="highlight">
|
||||
<span className="interval"></span>ms
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
19
examples/react-fast-refresh-test/tsconfig.json
Normal file
19
examples/react-fast-refresh-test/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve"
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
144
integration/scripts/browser.js
Normal file
144
integration/scripts/browser.js
Normal file
@@ -0,0 +1,144 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const http = require("http");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const fs = require("fs");
|
||||
const child_process = require("child_process");
|
||||
const snippetsDir = path.resolve(__dirname, "../snippets");
|
||||
const serverURL = process.env.TEST_SERVER_URL || "http://localhost:8080";
|
||||
|
||||
const DISABLE_HMR = !!process.env.DISABLE_HMR;
|
||||
const bunFlags = [
|
||||
`--origin=${serverURL}`,
|
||||
DISABLE_HMR && "--disable-hmr",
|
||||
].filter(Boolean);
|
||||
const bunExec = process.env.BUN_BIN || "bun";
|
||||
const bunProcess = child_process.spawn(bunExec, bunFlags, {
|
||||
cwd: snippetsDir,
|
||||
stdio: "pipe",
|
||||
|
||||
shell: false,
|
||||
});
|
||||
console.log("$", bunExec, bunFlags.join(" "));
|
||||
const isDebug = bunExec.endsWith("-debug");
|
||||
|
||||
bunProcess.stderr.pipe(process.stderr);
|
||||
bunProcess.stdout.pipe(process.stdout);
|
||||
bunProcess.once("error", (err) => {
|
||||
console.error("❌ bun error", err);
|
||||
process.exit(1);
|
||||
});
|
||||
process.on("beforeExit", () => {
|
||||
bunProcess?.kill(0);
|
||||
});
|
||||
|
||||
function writeSnapshot(name, code) {
|
||||
let file = path.join(__dirname, "../snapshots", name);
|
||||
|
||||
if (!DISABLE_HMR) {
|
||||
file =
|
||||
file.substring(0, file.length - path.extname(file).length) +
|
||||
".hmr" +
|
||||
path.extname(file);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.dirname(file))) {
|
||||
fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
isDebug
|
||||
? file.substring(0, file.length - path.extname(file).length) +
|
||||
".debug" +
|
||||
path.extname(file)
|
||||
: file,
|
||||
code
|
||||
);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const browser = await puppeteer.launch();
|
||||
const promises = [];
|
||||
let allTestsPassed = true;
|
||||
|
||||
async function runPage(key) {
|
||||
var page;
|
||||
try {
|
||||
page = await browser.newPage();
|
||||
page.on("console", (obj) =>
|
||||
console.log(`[console.${obj.type()}] ${obj.text()}`)
|
||||
);
|
||||
page.exposeFunction("testFail", (error) => {
|
||||
console.log(`❌ ${error}`);
|
||||
allTestsPassed = false;
|
||||
});
|
||||
let testDone = new Promise((resolve) => {
|
||||
page.exposeFunction("testDone", resolve);
|
||||
});
|
||||
await page.goto(`${serverURL}/`, {
|
||||
waitUntil: "domcontentloaded",
|
||||
});
|
||||
await page.evaluate(`
|
||||
globalThis.runTest("${key}");
|
||||
`);
|
||||
await testDone;
|
||||
|
||||
console.log(`✅ ${key}`);
|
||||
} catch (e) {
|
||||
allTestsPassed = false;
|
||||
console.log(`❌ ${key}: ${(e && e.message) || e}`);
|
||||
} finally {
|
||||
try {
|
||||
const code = await page.evaluate(`
|
||||
globalThis.getModuleScriptSrc("${key}");
|
||||
`);
|
||||
writeSnapshot(key, code);
|
||||
} catch (exception) {
|
||||
console.warn(`Failed to update snapshot: ${key}`, exception);
|
||||
}
|
||||
}
|
||||
|
||||
await page.close();
|
||||
}
|
||||
|
||||
const tests = [
|
||||
"/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js",
|
||||
"/bundled-entry-point.js",
|
||||
"/export.js",
|
||||
"/type-only-imports.ts",
|
||||
"/global-is-remapped-to-globalThis.js",
|
||||
"/multiple-imports.js",
|
||||
"/ts-fallback-rewrite-works.js",
|
||||
"/tsx-fallback-rewrite-works.js",
|
||||
"/lodash-regexp.js",
|
||||
"/unicode-identifiers.js",
|
||||
"/string-escapes.js",
|
||||
"/package-json-exports/index.js",
|
||||
"/array-args-with-default-values.js",
|
||||
"/forbid-in-is-correct.js",
|
||||
"/code-simplification-neql-define.js",
|
||||
];
|
||||
tests.reverse();
|
||||
|
||||
for (let test of tests) {
|
||||
await runPage(test);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
bunProcess.kill(0);
|
||||
|
||||
if (!allTestsPassed) {
|
||||
console.error(`❌ browser test failed`);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log(`✅ browser test passed`);
|
||||
bunProcess.kill(0);
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((error) =>
|
||||
setTimeout(() => {
|
||||
throw error;
|
||||
})
|
||||
);
|
||||
1
integration/snapshots/.prettierignore
Normal file
1
integration/snapshots/.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
*.js
|
||||
@@ -0,0 +1,25 @@
|
||||
var lines;
|
||||
const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
export function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(3474597122, "array-args-with-default-values.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var lines;
|
||||
const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_test as test
|
||||
};
|
||||
47
integration/snapshots/array-args-with-default-values.hmr.js
Normal file
47
integration/snapshots/array-args-with-default-values.hmr.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
Bun.activate(false);
|
||||
|
||||
var hmr = new HMR(3474597122, "array-args-with-default-values.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var lines;
|
||||
const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_test as test
|
||||
};
|
||||
25
integration/snapshots/array-args-with-default-values.js
Normal file
25
integration/snapshots/array-args-with-default-values.js
Normal file
@@ -0,0 +1,25 @@
|
||||
var lines;
|
||||
const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}));
|
||||
export function test() {
|
||||
let ran = false;
|
||||
lines = [
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined],
|
||||
[undefined, undefined, undefined, undefined]
|
||||
];
|
||||
for (let foo of data()) {
|
||||
console.assert(foo.a === null);
|
||||
console.assert(foo.b === null);
|
||||
console.assert(foo.c === null);
|
||||
console.assert(foo.d === null);
|
||||
ran = true;
|
||||
}
|
||||
console.assert(ran);
|
||||
testDone(import.meta.url);
|
||||
}
|
||||
9
integration/snapshots/bundled-entry-point.debug.js
Normal file
9
integration/snapshots/bundled-entry-point.debug.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var hello = null ?? "world";
|
||||
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
30
integration/snapshots/bundled-entry-point.hmr.debug.js
Normal file
30
integration/snapshots/bundled-entry-point.hmr.debug.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
Bun.activate(true);
|
||||
|
||||
var hmr = new HMR(3012834585, "bundled-entry-point.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var hello = null ?? "world";
|
||||
function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_test as test
|
||||
};
|
||||
30
integration/snapshots/bundled-entry-point.hmr.js
Normal file
30
integration/snapshots/bundled-entry-point.hmr.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRModule as HMR
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__HMRClient as Bun
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
Bun.activate(false);
|
||||
|
||||
var hmr = new HMR(3012834585, "bundled-entry-point.js"), exports = hmr.exports;
|
||||
(hmr._load = function() {
|
||||
var hello = null ?? "world";
|
||||
function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
hmr.exportAll({
|
||||
test: () => test
|
||||
});
|
||||
})();
|
||||
var $$hmr_test = hmr.exports.test;
|
||||
hmr._update = function(exports) {
|
||||
$$hmr_test = exports.test;
|
||||
};
|
||||
|
||||
export {
|
||||
$$hmr_test as test
|
||||
};
|
||||
9
integration/snapshots/bundled-entry-point.js
Normal file
9
integration/snapshots/bundled-entry-point.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
|
||||
var hello = null ?? "world";
|
||||
|
||||
export function test() {
|
||||
return testDone(import.meta.url);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
__require as require
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import {
|
||||
__cJS2eSM
|
||||
} from "http://localhost:8080/__runtime.js";
|
||||
import * as _login_b977_0 from "http://localhost:8080/_login.js";
|
||||
import * as _login_b977_1 from "http://localhost:8080/_login.js";
|
||||
import _login from "http://localhost:8080/_login.js";
|
||||
import _auth from "http://localhost:8080/_auth.js";
|
||||
import * as _loginReally from "http://localhost:8080/_login.js";
|
||||
import * as _loginReally2 from "http://localhost:8080/_login.js";
|
||||
import * as _authReally from "http://localhost:8080/_auth.js";
|
||||
|
||||
export default __cJS2eSM(function(module, exports) {
|
||||
;
|
||||
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
module.exports.iAmCommonJs = true;
|
||||
exports.YouAreCommonJS = true;
|
||||
require(_login_b977_0);
|
||||
require(_login_b977_1);
|
||||
Object.defineProperty(module.exports,"login",{get: () => _login, enumerable: true, configurable: true});
|
||||
var test = function test() {
|
||||
return testDone(import.meta.url);
|
||||
};
|
||||
Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true});
|
||||
let foo, bar;
|
||||
Object.defineProperties(module.exports,{'foo': {get: () => foo, set: ($_newValue) => {foo = $_newValue;}, enumerable: true, configurable: true},
|
||||
'bar': {get: () => bar, set: ($_newValue) => {bar = $_newValue;}, enumerable: true, configurable: true}});
|
||||
}, "cjs-transform-shouldnt-have-static-imports-in-cjs-function.js");
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user