Compare commits

...

1357 Commits

Author SHA1 Message Date
Jarred Sumner
ca5245bb9b 📷 2021-12-27 20:44:37 -08:00
Jarred Sumner
84b3c952d9 backwards 2021-12-27 20:37:15 -08:00
Jarred Sumner
6ef71a800f Update pull.sh 2021-12-27 20:33:49 -08:00
Jarred Sumner
77778aeadf Update build-base.sh 2021-12-27 20:32:50 -08:00
Jarred Sumner
e8275b767e ypo 2021-12-27 20:32:24 -08:00
Jarred Sumner
efdf7fb93e Update build-base.sh 2021-12-27 20:32:00 -08:00
Jarred Sumner
1fd2d26185 use buildx 2021-12-27 20:27:34 -08:00
Jarred Sumner
cac19d9e8b Set platform when pulling 2021-12-27 20:09:22 -08:00
Jarred Sumner
1d03df7d33 Use mimalloc archive file on macOS to work around https://github.com/microsoft/mimalloc/issues/512 2021-12-27 20:03:03 -08:00
Jarred Sumner
90ae5cd897 Update Dockerfile 2021-12-27 19:14:44 -08:00
Jarred Sumner
bb346c8d2b Update build-id 2021-12-27 19:07:47 -08:00
Jarred Sumner
317932204e Add clone-submodules to devcontainer makefile 2021-12-27 19:07:12 -08:00
Jarred Sumner
a48c7e1d83 Update devcontainer 2021-12-27 18:54:38 -08:00
Jarred Sumner
336a4b6ac2 Prepare to run unit tests & remove some dead code (#92)
* Remove some dead code

* 💀 code

* Fix the zig tests

* [JS Printer] Print integers faster & less scientific notation on decimals

* 💀 dead code

* skip

* Run all the unit tests
2021-12-27 18:06:31 -08:00
Jarred Sumner
c9c7521f4f Fix edgecase in bun run where it would choose a directory instead of a file 2021-12-27 04:27:15 -08:00
Jarred Sumner
b455bc467d Fixes #90 2021-12-26 17:04:26 -08:00
Jarred Sumner
d1df057d08 Fix bug with bun add @scoped/package 2021-12-26 16:48:29 -08:00
Jarred Sumner
062aebeba0 Fix zig tests 2021-12-26 16:48:11 -08:00
Jarred Sumner
cff83a3fec Add dead code in build.zig for linking object files 2021-12-26 16:47:59 -08:00
Jarred Sumner
b08d5267cb Update bun-framework-next.yml 2021-12-26 03:21:17 -08:00
Jarred Sumner
1ce37acde6 Update bun.yml 2021-12-26 03:17:39 -08:00
Jarred Sumner
b7cd0c63e5 Update bun.yml 2021-12-26 03:16:40 -08:00
Jarred Sumner
a866da84d9 Update README.md 2021-12-26 03:14:15 -08:00
Jarred Sumner
6908f44aa2 Include docker 2021-12-26 03:13:50 -08:00
Jarred Sumner
181b8a2744 Update bun.yml 2021-12-26 02:48:24 -08:00
Jarred Sumner
5a7bebc8b5 Update Dockerfile 2021-12-26 02:02:14 -08:00
Jarred Sumner
536d6ab302 github actions (#91)
* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update Dockerfile

* switch

* 😯

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* wip

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* cache is broken

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update bun.yml

* bust it

* Update Dockerfile

* jm

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update Dockerfile

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* wip

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update Makefile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* pass executablePath

* alright

* Update Makefile

* Update Dockerfile

* Update Dockerfile

* Update Makefile

* Update Makefile

* Update Dockerfile

* lets try that

* Update Dockerfile

* Update bun.yml

* hm

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* not interactive

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* simplify this

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* missing

* Update Dockerfile

* Update Dockerfile

* wrong dir

* Update Dockerfile

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update bun.yml

* ordering

* Update Dockerfile

* Update bun.yml

* run-test file

* pass github workspace

* hm

* Update bun.yml

* copy the file

* Update run-test.sh

* Update bun.yml

* Update bun.yml

* Update bun.yml

* try this way

* Update bun.yml

* maybe?

* Update bun.yml

* maybe taht's it?

* maybe this

* cache

* up

* Update bun.yml

* Update bun.yml

* try this one i guess

* okay that might do it

* Update Dockerfile

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update chrome.json

* Update chrome.json

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* hm

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* fix caching I think

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* Update bun.yml

* maybe

* Update bun.yml

* fixup

* Update bun.yml

* Update bun.yml

* Update bun.yml

* maybe this time

* Update bun.yml

* Update Dockerfile

* random name

* ok

* explicit runner

* Update bun.yml

* Update bun.yml

* try deleting the files so the layer caching doesn't happen

* 🏃

* Update bun.yml

* Update bun.yml

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Dockerfile.base

* node.js

* Update bun.yml

* Update Dockerfile

* Update Dockerfile.base

* cleanup
2021-12-26 01:40:37 -08:00
Jarred Sumner
99446ffa8a zig 2021-12-24 20:44:36 -08:00
Jarred Sumner
143973e031 Fix rare crash when new thread is created, possibly only on musl 2021-12-24 20:44:25 -08:00
Jarred Sumner
bb5ad6e1ad Cleanup build issues 2021-12-24 20:43:53 -08:00
Jarred Sumner
6ae433249d musl 2021-12-24 03:53:16 -08:00
Jarred Sumner
5f5b824ade prepare to push dockerfile 2021-12-23 22:43:13 -08:00
Jarred Sumner
34abc8116c Typo 2021-12-24 06:34:33 +00:00
Jarred Sumner
1efaaefd63 Update Dockerfile 2021-12-23 22:18:51 -08:00
Jarred Sumner
cfd635786a Clarify 2021-12-24 06:17:14 +00:00
Jarred Sumner
11e3faa8da [bun bun] Improve error mesage when resolving entry point fails 2021-12-24 06:15:44 +00:00
Jarred Sumner
1002990619 Make integration tests more Docker-friendly 2021-12-24 06:15:44 +00:00
Jarred Sumner
a94bbd8f3c [bun create] Run with bun run 2021-12-24 06:15:44 +00:00
Jarred Sumner
46354da728 Add linux aarch64 target to installer 2021-12-24 06:15:44 +00:00
Jarred Sumner
2c7c2b3fa6 Update README.md 2021-12-23 21:13:30 -08:00
Jarred Sumner
938d866c1b 💅 2021-12-23 21:12:19 -08:00
Jarred Sumner
42ff5415ba Merge branch 'main' of github.com:/Jarred-Sumner/bun into main 2021-12-24 04:56:42 +00:00
Jarred Sumner
0e52be8427 Don't send os.MSG_NOSIGNAL 2021-12-24 04:50:27 +00:00
Jarred Sumner
5105614b83 Improve devcontainer environment errors 2021-12-24 04:49:57 +00:00
Jarred Sumner
77fc310a70 Update README.md 2021-12-23 19:59:26 -08:00
Jarred Sumner
3541177d50 typo 2021-12-23 19:58:49 -08:00
Jarred Sumner
3c3ab57cf6 💅 2021-12-23 19:57:47 -08:00
Jarred Sumner
b73e7a9732 Add VSCode devcontainer environment for easy contributing 2021-12-23 18:40:03 -08:00
Jarred Sumner
2047140dda Workaround miscompilation so JavaScriptCore runs on Linux AARCH64 2021-12-23 23:47:12 +00:00
Jarred Sumner
b7e2f6c71a Don't print out bytes in error 2021-12-23 02:02:31 -08:00
Jarred Sumner
e1505d88b1 Prevent crash due to SIGPIPE 2021-12-23 00:43:34 -08:00
Jarred Sumner
d04e5ea0ba [bun-framework-next] Handle edgecase where for some reason the document returned was empty 2021-12-22 22:46:34 -08:00
Jarred Sumner
3ebcd9bbe7 [bun-framework-next] Bump 2021-12-22 22:36:26 -08:00
Jarred Sumner
ab9ccc985a Bump 2021-12-22 22:34:54 -08:00
Jarred Sumner
2188be219e [bun-framework-next] fix ts errors 2021-12-22 22:31:25 -08:00
Jarred Sumner
a34792ce16 [Bun.js] Fix SSR when using fetch 2021-12-22 21:39:05 -08:00
Jarred Sumner
9160c9ae31 Fix spawning child bun processes 2021-12-22 21:37:33 -08:00
Jarred Sumner
8e05fbf43f Fix URL() in bun-framework-next 2021-12-22 21:35:08 -08:00
Jarred Sumner
c59ff7416a Move install above table of contents 2021-12-22 19:24:18 -08:00
Jarred Sumner
c943072193 Merge pull request #87 from alexkuz/patch-2
Add table of contents and tidy up README a bit
2021-12-22 19:23:31 -08:00
Jarred Sumner
d39cc1fb5f Keep it at 1024, but should be okay since we now reduce it 2021-12-22 19:16:47 -08:00
Jarred Sumner
005a0ec931 Update io_darwin.zig 2021-12-22 19:10:41 -08:00
Jarred Sumner
2cfdf29364 Fix error from requesting too much from io_uring 2021-12-22 19:05:39 -08:00
Alexander Kuznetsov
7254c71683 Add table of contents and tidy up README a bit 2021-12-23 01:10:14 +03:00
Jarred Sumner
328534605f ✂️ 💀 code 2021-12-22 02:41:31 -08:00
Jarred Sumner
5eb7383613 Update build-id 2021-12-22 02:41:14 -08:00
Jarred Sumner
75c2f4f394 fix test 2021-12-22 02:40:36 -08:00
Jarred Sumner
6cbe506915 [bun install] Fix bug with >= ranges (and improve test coverage) 2021-12-22 02:38:44 -08:00
Jarred Sumner
3d6ac8face Stack limit detection doesn't really work 2021-12-21 22:58:26 -08:00
Jarred Sumner
14fe014fdf Update Makefile 2021-12-21 22:41:41 -08:00
Jarred Sumner
8f16eeb82a copy-bun-release-dir 2021-12-21 22:31:50 -08:00
Jarred SUmner
84e5072741 WIP dockerfile fix 2021-12-21 22:01:22 -08:00
Jarred Sumner
3f72da9d0b Use Node 14 compatible syntax 2021-12-21 21:56:49 -08:00
Jarred Sumner
873e12c7c6 Add script for building zig 2021-12-21 21:56:01 -08:00
Jarred SUmner
fecfb784ee Run tests 2021-12-21 20:33:36 -08:00
Jarred SUmner
5a7014a418 Slightly safer 2021-12-21 19:44:59 -08:00
Jarred SUmner
ceae7ef672 Slightly less pointer chasing 2021-12-21 19:44:09 -08:00
Jarred SUmner
67b09911c1 Fix crash when TSConfigJSON has an error and multiple TSConfigJSON files were parsed \nThis was caused by reusing the filename buffer inappropriately. For unclear reasons, this only impacted Linux. 2021-12-21 19:43:43 -08:00
Jarred SUmner
3043bb70e1 Update Dockerfile 2021-12-21 19:41:26 -08:00
Jarred Sumner
ff99155f7d --dump-limits flag to inspect what the max file descriptor & stack size is 2021-12-21 18:48:52 -08:00
Jarred Sumner
dc2dae5d87 Update build-id 2021-12-21 18:02:50 -08:00
Jarred Sumner
76eeb5df42 Respect close_handles when extracting a tarball 2021-12-21 17:49:36 -08:00
Jarred Sumner
185a985a85 Update README.md 2021-12-21 17:37:19 -08:00
Jarred Sumner
834e8359ee Don't print bytes in error messages 2021-12-21 17:37:13 -08:00
Jarred Sumner
503f70bba4 Update README.md 2021-12-21 16:57:55 -08:00
Jarred Sumner
c3e45b662a Update README.md 2021-12-21 16:38:20 -08:00
Jarred Sumner
4f16f87b4d Write some docs 2021-12-21 16:35:52 -08:00
Jarred Sumner
9db1a5786d Merge pull request #86 from afonsoduarte/patch-1
Fixes typo in README
2021-12-21 15:59:04 -08:00
Afonso
b9b150f147 Fixes typo in README 2021-12-21 23:53:45 +00:00
Jarred Sumner
0eecec75e2 Update Makefile 2021-12-21 15:22:10 -08:00
Jarred Sumner
581f3540b6 Mention bun install in readme (still writing) 2021-12-21 15:08:11 -08:00
Jarred Sumner
68dabd4d25 Update README.md 2021-12-21 14:13:18 -08:00
Jarred Sumner
59b171db04 Building for Linux AMD64 via Dockerfile works now 2021-12-21 03:03:41 -08:00
Jarred Sumner
e97ebfb036 Update Dockerfile 2021-12-21 02:30:20 -08:00
Jarred Sumner
7380d03e00 Update Dockerfile 2021-12-21 02:15:27 -08:00
Jarred Sumner
5be558ef15 Update Dockerfile 2021-12-21 02:11:32 -08:00
Jarred Sumner
a7116cf353 switch to build arch 2021-12-21 02:06:57 -08:00
Jarred Sumner
3147f69435 Update Dockerfile 2021-12-21 02:04:38 -08:00
Jarred Sumner
0ef9b00dc7 Update .dockerignore 2021-12-21 01:54:54 -08:00
Jarred Sumner
bc05793cbe Delete Dockerfile-zig 2021-12-21 01:54:48 -08:00
Jarred Sumner
fd349f3020 Update Makefile 2021-12-21 01:54:45 -08:00
Jarred Sumner
df5a3c4da4 Add Dockerfile for building Bun 2021-12-21 01:54:42 -08:00
Jarred Sumner
fe415a30c5 Copy-pastable 2021-12-21 01:47:04 -08:00
Jarred Sumner
382208e59c Handle aarch64 vs arm64 2021-12-21 00:13:57 -08:00
Jarred Sumner
ed02a24e0e Update build.zig 2021-12-21 00:12:03 -08:00
Jarred Sumner
e712d3458c Update build.zig 2021-12-21 00:05:47 -08:00
Jarred Sumner
685681dedc system libiconv 2021-12-21 00:03:15 -08:00
Jarred Sumner
b412da6b8a System libiconv 2021-12-21 00:03:04 -08:00
Jarred Sumner
03dc674c2d Prevent linking to glibc 2.3x in release builds 2021-12-20 19:47:33 -08:00
Jarred Sumner
d0bcd3c6fb -static doesn't work 2021-12-20 18:13:39 -08:00
Jarred Sumner
6649218e17 Update dependency.zig 2021-12-20 17:56:22 -08:00
Jarred Sumner
453fae4a5c [bun install] Strip leading v in versions 2021-12-20 17:52:50 -08:00
Jarred Sumner
3f32222360 Update makefile to better support building JavaScriptCore on Linux 2021-12-20 17:18:05 -08:00
Jarred Sumner
479705e8ce Fix error 2021-12-20 01:49:39 -08:00
Jarred Sumner
e8fc9d5c9b Set macOS min flags 2021-12-20 00:59:21 -08:00
Jarred Sumner
38d3b200b5 Update cli.zig 2021-12-20 00:00:04 -08:00
Jarred Sumner
a0551a9b8b Autocomplete popular package names (thanks @evanwashere) 2021-12-19 23:30:25 -08:00
Jarred Sumner
be03fc273a Move folder_resolver to a separate file 2021-12-19 17:31:29 -08:00
Jarred Sumner
ab496e9e34 Remove duplicate code 2021-12-19 17:31:10 -08:00
Jarred Sumner
81e7576150 Fix error and fix ../ 2021-12-19 17:09:19 -08:00
Jarred Sumner
2e69f15c20 Relative paths outside project 2021-12-19 14:48:12 -08:00
Jarred Sumner
0c7b35d0ab [bun install] Support file: protocol for installing folders as packages 2021-12-19 14:38:32 -08:00
Jarred Sumner
e12f10ae0e [bun install] More git protocols are valid 2021-12-19 14:37:43 -08:00
Jarred Sumner
961b704a8e Update install.zig 2021-12-18 23:40:48 -08:00
Jarred Sumner
4ee8055f17 Show help text when no options 2021-12-18 23:29:39 -08:00
Jarred Sumner
394335fa91 Update bun.fish 2021-12-18 23:06:07 -08:00
Jarred Sumner
8125c05be0 Update fish completions 2021-12-18 23:04:31 -08:00
Jarred Sumner
059f01d23a Add new zsh completions 2021-12-18 21:44:17 -08:00
Jarred Sumner
5f80f9c814 cross-promotion 2021-12-18 21:36:12 -08:00
Jarred Sumner
0cee57f1d9 Merge pull request #80 from Jarred-Sumner/jarred/npm-install
bun install
2021-12-18 21:07:07 -08:00
Jarred Sumner
eab99b3bae Remove references to s2n 2021-12-18 21:06:15 -08:00
Jarred Sumner
a1e1509358 Create .gitattributes 2021-12-18 21:03:31 -08:00
Jarred Sumner
39d8b0c8c1 cleanup 2021-12-18 21:03:26 -08:00
Jarred Sumner
1356029bea [bun install] Ignore peer dependencies for root packages 2021-12-18 20:39:53 -08:00
Jarred Sumner
b8af8a1af0 Update Makefile 2021-12-18 20:33:47 -08:00
Jarred Sumner
06c79cffae 💅 2021-12-18 20:25:02 -08:00
Jarred Sumner
430fe09d6d Delete synchronous HTTP client! 2021-12-18 20:23:10 -08:00
Jarred Sumner
5455c71f93 fix build issue on macOS 2021-12-18 20:03:09 -08:00
Jarred Sumner
e2d6c692c4 Use new http in bun upgrade 2021-12-18 20:03:00 -08:00
Jarred Sumner
501fab0bef 2x - 5x faster bun create 2021-12-18 20:02:33 -08:00
Jarred Sumner
1f1c337eb6 no more hop 2021-12-18 17:54:07 -08:00
Jarred Sumner
1c9131a5d7 Not using hop! 2021-12-18 17:50:35 -08:00
Jarred Sumner
fb758a32e1 Update Makefile 2021-12-17 23:07:01 -08:00
Jarred Sumner
d4c55557c3 Implement hop archive format 2021-12-17 23:06:56 -08:00
Jarred Sumner
0e39174c48 Update the misctools bins 2021-12-17 16:59:49 -08:00
Jarred Sumner
40401a6ed2 Update build-id 2021-12-17 16:12:33 -08:00
Jarred SUmner
74ea36ac1c WIP hop 2021-12-17 15:47:24 -08:00
Jarred Sumner
2d48674c5b bindings 2021-12-17 02:44:55 -08:00
Jarred Sumner
42c7d887d3 👶event loop 2021-12-17 02:44:35 -08:00
Jarred Sumner
8dcaaa9e09 packaging 2021-12-17 02:43:43 -08:00
Jarred Sumner
267e926a38 [internal] Use more packages 2021-12-17 02:42:55 -08:00
Jarred Sumner
11e6ffaae9 Update launch.json 2021-12-16 19:18:51 -08:00
Jarred Sumner
6a5dd6ed58 Update build.zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
bcd68b937d wip 2021-12-16 19:18:51 -08:00
Jarred Sumner
9fab7ca06c Add some timestamps 2021-12-16 19:18:51 -08:00
Jarred Sumner
4082a34599 Update install.zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
f9debc72fa Print specifically installed packages 2021-12-16 19:18:51 -08:00
Jarred Sumner
b363402f45 [bun install] Support linking binaries & native binaries 2021-12-16 19:18:51 -08:00
Jarred Sumner
b0942fbc37 [bun install] Fix edgecase with optional peer deps 2021-12-16 19:18:51 -08:00
Jarred Sumner
e3a12ea1a9 [bun install] Fix bun add so it writes the resolved version to package.json 2021-12-16 19:18:51 -08:00
Jarred Sumner
5dd6fb8547 [bun install] Add clonefile_each_dir and hardlink backend for copying files 2021-12-16 19:18:51 -08:00
Jarred Sumner
8586d2e41c [bun install] Support dependencies prefixed with "npm:" 2021-12-16 19:18:51 -08:00
Jarred Sumner
ba1e95fd43 [bun install] Hoisting works! 2021-12-16 19:18:51 -08:00
Jarred Sumner
e7538d7b26 document failed Link tag experiment in script src 2021-12-16 19:18:51 -08:00
Jarred Sumner
2b7ebaceb2 wip slow hoister 2021-12-16 19:18:51 -08:00
Jarred Sumner
3de3c3c143 [bun install] Allow skipping peer, optional, and dev dependency installs. Hoisting 2021-12-16 19:18:51 -08:00
Jarred Sumner
0e0e325e5b [bun install] optionalDependencies override dependencies if both specified 2021-12-16 19:18:51 -08:00
Jarred Sumner
e97106c770 [bun install] order() and fmt() 2021-12-16 19:18:51 -08:00
Jarred Sumner
50f8e0daa8 [bun install] Improve test coverage for tilda version ranges 2021-12-16 19:18:51 -08:00
Jarred Sumner
efcf846b2c [bun install] Fix bug with ~Tilda 2021-12-16 19:18:51 -08:00
Jarred Sumner
afe3e13345 [bun install] Fix bug with optional peer deps 2021-12-16 19:18:51 -08:00
Jarred Sumner
461c769ac4 Track peer dependencies but don't install them 2021-12-16 19:18:51 -08:00
Jarred Sumner
0dc0d6c31c Update npm.zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
49d8ea4886 [bun install] Fix case when lockfile exists 2021-12-16 19:18:51 -08:00
Jarred Sumner
e66776a79f Slightly better progress bar 2021-12-16 19:18:51 -08:00
Jarred Sumner
3036cbe552 bun add and bun remove sorta works now. but not fast enough! 2021-12-16 19:18:51 -08:00
Jarred Sumner
393aa076bc [bun install] Most of bun add, bun remove 2021-12-16 19:18:51 -08:00
Jarred Sumner
0ef6f81843 Add some progress feedback 2021-12-16 19:18:51 -08:00
Jarred Sumner
339fe00dfe CLI flags 2021-12-16 19:18:51 -08:00
Jarred Sumner
6382bb5333 [bun install] Start add/remove command 2021-12-16 19:18:51 -08:00
Jarred Sumner
41c60fb848 [bun install] move around some code 2021-12-16 19:18:51 -08:00
Jarred Sumner
8df49bc823 Update install.zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
ab4129061e [bun install] Deduplicate packages by default 2021-12-16 19:18:51 -08:00
Jarred Sumner
021a670d86 Fix bug with ~tilda ranges 2021-12-16 19:18:51 -08:00
Jarred Sumner
fa27551428 [bun install] Install top-level node_modules 2021-12-16 19:18:51 -08:00
Jarred Sumner
538243dc3b [bun install] Deterministic lockfile and simple installs 2021-12-16 19:18:51 -08:00
Jarred Sumner
d83c610002 [bun install] Support printing yarn.lock 2021-12-16 19:18:51 -08:00
Jarred Sumner
196f7eb101 Update launch.json 2021-12-16 19:18:51 -08:00
Jarred Sumner
a1167d80b2 Update .gitignore 2021-12-16 19:18:51 -08:00
Jarred Sumner
a765b13f52 [bun install] Add some config flags 2021-12-16 19:18:51 -08:00
Jarred Sumner
45b3e9d03c [bun install] Shrink binary format size by 2.5x 2021-12-16 19:18:51 -08:00
Jarred Sumner
5844166047 [bun install] Load lockfile. Generate diffs 2021-12-16 19:18:51 -08:00
Jarred Sumner
c6dcc1cd9e [bun install] Lockfile saves. Starting to implement diffing 2021-12-16 19:18:51 -08:00
Jarred Sumner
118ed4d2ab [bun install] Generate a lockfile 2021-12-16 19:18:51 -08:00
Jarred Sumner
9fcd2c53c8 [JSON parser] const has better codegen (unlike in JavaScript!) 2021-12-16 19:18:51 -08:00
Jarred Sumner
da80830bc5 Mimalloc cleanup 2021-12-16 19:18:51 -08:00
Jarred Sumner
b060056480 Update memory_allocator.zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
b71df3a3d4 Bump mimalloc 2021-12-16 19:18:51 -08:00
Jarred Sumner
128e9861f9 [bun install] Most of the Lockfile format (not done yet) 2021-12-16 19:18:51 -08:00
Jarred Sumner
5d2cb27562 Start to restructure code 2021-12-16 19:18:51 -08:00
Jarred Sumner
75e340bfbf Resolve peer dependencies & optional dependencies too 2021-12-16 19:18:51 -08:00
Jarred Sumner
b5744e5da4 save and load manifest 2021-12-16 19:18:51 -08:00
Jarred Sumner
7bad5770a1 Channel seems faster or maybe the same? 2021-12-16 19:18:51 -08:00
Jarred Sumner
809c1e46d8 [npm install] starting to look good! 2021-12-16 19:18:51 -08:00
Jarred Sumner
c056093125 WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
88ea1de80f 📻 2021-12-16 19:18:51 -08:00
Jarred Sumner
7c8a835fa0 fix build 2021-12-16 19:18:51 -08:00
Jarred Sumner
c6317888da Fix redirects 2021-12-16 19:18:51 -08:00
Jarred Sumner
9f1946ce70 [npm install] Use BoringSSL for https:// requests 2021-12-16 19:18:51 -08:00
Jarred Sumner
32be2866f6 Replace S2N with BoringSSL (wip) 2021-12-16 19:18:51 -08:00
Jarred Sumner
448d60ebbf Update Makefile 2021-12-16 19:18:51 -08:00
Jarred Sumner
c536370ab8 [internal] readlink 2021-12-16 19:18:51 -08:00
Jarred Sumner
dccc6bf1af [http_debug] Pretty print 2021-12-16 19:18:51 -08:00
Jarred SUmner
e331ebbf7d [bun install] Linux async http 2021-12-16 19:18:51 -08:00
Jarred Sumner
b1660fa468 [bun install] async http request works I think? 2021-12-16 19:18:51 -08:00
Jarred Sumner
4af743766d [bun install] Begin to add io_uring (via tigerbeetle/@kprotty's interface) 2021-12-16 19:18:51 -08:00
Jarred Sumner
8f35f16c7e [libarchive] Fix occasional segfault 2021-12-16 19:18:51 -08:00
Jarred Sumner
e08710e373 [bun install] Resolve more packages 2021-12-16 19:18:51 -08:00
Jarred Sumner
48b9af1298 [bun install] Track build/pre tags with a bitset 2021-12-16 19:18:51 -08:00
Jarred Sumner
cec59bc580 don't need sleep since not a universal binary anymore 2021-12-16 19:18:51 -08:00
Jarred Sumner
dff23f5a7b wip 2021-12-16 19:18:51 -08:00
Jarred Sumner
bcdff7f6f0 [bun install] Support dist-tags 2021-12-16 19:18:51 -08:00
Jarred Sumner
49dbf79e81 WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
1610ff33ea [bun install] some things install 2021-12-16 19:18:51 -08:00
Jarred Sumner
b5fd121f26 [bun install] WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
c292ea7b94 [bun install] WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
de56f3a562 [bun install] WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
94e469c803 [bun install] WIP 2021-12-16 19:18:51 -08:00
Jarred Sumner
0d369baf9d [bun install] implement serialization/deserialization of package versions in an efficient binary format
This is most of the code but does not compile yet
2021-12-16 19:18:51 -08:00
Jarred Sumner
0ab00df154 [bun install] Make Semver serializable 2021-12-16 19:18:51 -08:00
Jarred Sumner
6167d95167 Update string_immutable.zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
d582e42d4d wip 2021-12-16 19:18:51 -08:00
Jarred Sumner
6da14ae310 wip 2021-12-16 19:18:51 -08:00
Jarred Sumner
442f85e89e [bun install] support hyphen ranges in node-semver 2021-12-16 19:18:51 -08:00
Jarred Sumner
8cf8bf441e [bun install] node-semver works excluding hyphen ranges 2021-12-16 19:18:51 -08:00
Jarred Sumner
2cc25f64f2 [bun install] Add tests for parsing Semver versions 2021-12-16 19:18:51 -08:00
Jarred Sumner
035008cd9d [bun install] node-semver implementation (doesn't run yet) 2021-12-16 19:18:51 -08:00
Jarred Sumner
e7f1ff14d6 [bun install] Begin to port my golang node-semver to Zig 2021-12-16 19:18:51 -08:00
Jarred Sumner
c092d2ba70 Update snippets.json 2021-12-16 19:18:30 -08:00
Jarred Sumner
d1783babd9 📷 2021-12-16 18:32:48 -08:00
Jarred Sumner
7519f364e5 Update README.md 2021-12-16 18:26:40 -08:00
Jarred Sumner
7f9ab7dfce ICU should be in deps 2021-12-16 18:25:59 -08:00
Jarred Sumner
f9d87f28f6 Update build-id 2021-12-16 18:16:28 -08:00
Jarred Sumner
dd7225fb2a Add regression test for try / catch with import & require 2021-12-16 18:14:41 -08:00
Jarred Sumner
134748a238 [transpiler] Partially support top-level await in HMR 2021-12-16 18:14:06 -08:00
Jarred Sumner
b57d890cbd Update bundler.zig 2021-12-16 18:01:07 -08:00
Jarred Sumner
50163e1385 Disable imports which are not found 2021-12-16 17:57:44 -08:00
Jarred Sumner
fde4cd4d17 Enable top-level await in browsers 2021-12-16 17:57:13 -08:00
Jarred Sumner
b6e164355b [JS parser] Track import records that were converted to star imports due to require 2021-12-16 17:57:03 -08:00
Jarred Sumner
2e9af40bca [transpiler] Don't insert import statements for disabled require() 2021-12-16 17:56:32 -08:00
Jarred Sumner
2f45c3d2cd Update Makefile 2021-12-16 15:37:38 -08:00
Jarred Sumner
d763c0ab4e Bump again I guess 2021-12-16 15:37:32 -08:00
Jarred Sumner
baa93d4b37 📷 2021-12-16 03:42:28 -08:00
Jarred Sumner
dd7659c643 Print errors below warnings 2021-12-16 02:42:09 -08:00
Jarred Sumner
aed6f89772 [bun bun] Fix a race condition introduced in #55ff681976f7bae5a428c409061991c07fa492e7 2021-12-16 02:41:47 -08:00
Jarred Sumner
39af1ccc7c Update js_printer.zig 2021-12-16 01:48:50 -08:00
Jarred Sumner
52f4ba767a [http] Fix bug with Link header 2021-12-16 01:48:31 -08:00
Jarred Sumner
0f853a2fee Update js_printer.zig 2021-12-16 01:33:07 -08:00
Jarred Sumner
ca807afba2 📷 2021-12-16 01:31:09 -08:00
Jarred Sumner
e349e54cb8 bump build id 2021-12-16 01:31:01 -08:00
Jarred Sumner
39218ec0f7 [macros] Do not automatically load node_modules.bun in macros 2021-12-16 01:30:54 -08:00
Jarred Sumner
908d9d86b3 [macros] Slightly improve error message if macros fail to load 2021-12-16 01:30:23 -08:00
Jarred Sumner
92f3efeac2 [bundler][JS transpiler] Improve reliability of ESM <> CommonJS interop
This fixes a number of issues caused by not using live bindings when referencing bundled code. This also fixes an issue with libraries looping over `Object.keys(moduleNamespace)`
2021-12-16 01:29:45 -08:00
Jarred Sumner
a772b56cb6 [http] Ensure errors from macros can see source code 2021-12-16 00:47:24 -08:00
Jarred Sumner
bd6b9a58d3 [internal] disable debug workaround 2021-12-16 00:44:39 -08:00
Jarred Sumner
873cacc15a [bundler] Fix edgecase where certain modules would load unbundled versions
Some packages have many `package.json` files with no `name` in them, often to indicate `sideEffects` or change `exports`.

When bundling node_modules, we need a name to map a package back to the list of bundled packages.
2021-12-16 00:43:39 -08:00
Jarred Sumner
55ff681976 [resolver] Change extension order based on import kind 2021-12-16 00:41:23 -08:00
Jarred Sumner
618ecdb76c [resolver] When importing from an ES Module, prefer .{m,c}{t,j}s 2021-12-16 00:39:49 -08:00
Jarred Sumner
8af6ad7278 wip fix live bindings 2021-12-15 17:08:04 -08:00
Jarred Sumner
c07de8c4d3 [JS transpiler] Simplify CommonJS interop callback 2021-12-15 17:08:04 -08:00
Jarred Sumner
e10fe8aaad [JS transpiler] Ensure reserved words don't end up in nonUniqueIdentifier() 2021-12-15 17:08:04 -08:00
Jarred Sumner
feb45edf6d [JS Parser] Add regression test 2021-12-15 16:58:41 -08:00
Jarred Sumner
0a916543b3 [JS Parser] Fix bug with template literals that create new scopes in the tag and the template literal value 2021-12-15 16:52:38 -08:00
Jarred Sumner
2c53ff2980 Add a resource hint for preloading node_modules.bun and route asset in the fallback rendering 2021-12-11 15:58:16 -08:00
Jarred Sumner
b2fcc027a9 [resolver] Do not throw on require()/import errors when they're caught (and import is an await target) 2021-12-04 03:26:14 -08:00
Jarred Sumner
1dc78ba4b7 Bump 2021-11-26 00:13:00 -08:00
Jarred Sumner
04e0910dea Fix occasional segfault when parsing JSON in http server 2021-11-25 17:17:17 -08:00
Jarred Sumner
d19a6199ea Revert "Merge pull request #70 from Jarred-Sumner/lithdew/picohttp-mimalloc"
This reverts commit e8925e47b0, reversing
changes made to f82aa92c38.
2021-11-25 17:08:22 -08:00
Jarred Sumner
e8925e47b0 Merge pull request #70 from Jarred-Sumner/lithdew/picohttp-mimalloc 2021-11-24 13:16:26 -08:00
Kenta Iwasaki
cc712668f0 mimalloc: patch malloc/free 2021-11-24 21:05:15 +00:00
Kenta Iwasaki
f7dbf5ac38 deps: add missing mimalloc dep to jsc bindings header generator 2021-11-24 17:26:02 +00:00
Kenta Iwasaki
283a01493c deps: build picohttp and mimalloc using zig
Reduce the amount of dependencies which need to be externally built
before Bun can be built.

Remove clause to enforce that Bash syntax is used in Makefile, as the
clause only works on a few Linux distros which assume bash is located at
/bin/bash.
2021-11-24 17:09:54 +00:00
Jarred Sumner
f82aa92c38 Merge pull request #65 from Jarred-Sumner/bun-framework-next-actions
Begin working on CI tasks for bun-framework-next
2021-11-23 16:35:45 -08:00
Jack Hanford
7660f72745 update Next version on global 2021-11-23 16:55:26 -05:00
Jarred Sumner
4e4f2058c2 Update build-id 2021-11-23 13:54:41 -08:00
Jack Hanford
ca25e32c0f fix shallow routing 2021-11-23 16:23:31 -05:00
Jack Hanford
5a1f60c729 remove comment 2021-11-23 11:05:05 -05:00
Jack Hanford
ac242f94ca add react-dom as devDep 2021-11-23 10:53:44 -05:00
Jack Hanford
9ab9b01a64 stop installing textencoder 2021-11-23 10:51:08 -05:00
Jack Hanford
cdeb39bd7f begin addressing more feedback 2021-11-23 10:42:04 -05:00
Jack Hanford
1d01ffeb9e remove .then 2021-11-22 22:19:53 -05:00
Jack Hanford
25a49005cc another try 2021-11-22 21:58:35 -05:00
Jack Hanford
875b60dfe5 add type fns 2021-11-22 21:55:57 -05:00
Jack Hanford
c071037485 try adding lib.ts 2021-11-22 21:52:28 -05:00
Jack Hanford
4edfa171f0 update copy 2021-11-22 21:28:23 -05:00
Jack Hanford
0eb3cdc43c add typechecking to action 2021-11-22 21:27:51 -05:00
Jack Hanford
f747fd9dfa ts-expect-error the remaining ts-errors 2021-11-22 21:25:57 -05:00
Jack Hanford
c06e34c687 misc 2021-11-22 10:23:14 -08:00
Jack Hanford
7f62169b5e add prettier to root 2021-11-22 10:21:29 -08:00
Jack Hanford
5b2c7ad1f3 another try 2021-11-22 10:21:29 -08:00
Jack Hanford
c535cd7613 remove filter from action 2021-11-22 10:21:29 -08:00
Jack Hanford
6e21c9927c remove workspace caching 2021-11-22 10:21:29 -08:00
Jack Hanford
c3d9804e85 reset file 2021-11-22 10:21:29 -08:00
Jack Hanford
30c79875a3 remove pnpm-workspace 2021-11-22 10:21:29 -08:00
Jack Hanford
a79153f6e0 remove unused proxy shim 2021-11-22 10:21:29 -08:00
Jack Hanford
87319ba73d remove export from empty 2021-11-22 10:21:29 -08:00
Jack Hanford
cb18bf7e5d begin working on renderDocument 2021-11-22 10:21:29 -08:00
Jack Hanford
304a36b814 fix lockfile 2021-11-22 10:21:29 -08:00
Jack Hanford
6ee673095c continue fixing typescript errors 2021-11-22 10:21:28 -08:00
Jack Hanford
cf4964c8f4 add empty.js 2021-11-22 10:21:28 -08:00
Jack Hanford
a1b88e85fd mv empty.tsx -> empty.js 2021-11-22 10:21:27 -08:00
Jack Hanford
46a8215092 consolidate empty files / references to one empty.tsx 2021-11-22 10:21:14 -08:00
Jack Hanford
62694f0ee9 add typescript checking 2021-11-22 10:20:47 -08:00
Jack Hanford
e8bdf1c7db move into workflows folder 2021-11-22 10:20:47 -08:00
Jack Hanford
2af4192756 begin working on CI tasks for bun-framework-next 2021-11-22 10:20:47 -08:00
Jarred Sumner
fd80d0a22d Fix loading CSS benchmark 2021-11-21 17:30:50 -08:00
Jarred Sumner
86743ab361 Bump bun-framework-next 2021-11-21 17:04:18 -08:00
Jarred Sumner
cca8081f2e add env var for disabling bun.js SSR 2021-11-21 17:02:21 -08:00
Jarred Sumner
5c5b246cc3 [bun-framework-next] Fix React 18 in fallback mode 2021-11-21 16:58:50 -08:00
Jarred Sumner
469a36e3b6 [HMR] Large perf improvement for JS hot reloads at runtime
From benchmarking, I noticed that a lot of time was spent running
`HMRModule.update()`.

We don't need to call that function if updates for the same module ID have not changed any exports
2021-11-21 03:52:14 -08:00
Jarred Sumner
f9d333bec2 Merge pull request #68 from mfeckie/docs/dev
Docs/dev
2021-11-19 17:54:01 -08:00
Martin Feckie
38879cd3d9 Add information about code signing 2021-11-20 09:44:41 +08:00
Martin Feckie
eb3123adb8 Add information about node modules 2021-11-20 08:54:31 +08:00
Jarred Sumner
2b4f20b94c Update build-id 2021-11-16 21:28:00 -08:00
Jarred Sumner
19949c0743 Update fixtures.zig 2021-11-16 21:26:41 -08:00
Jarred Sumner
8d03e0cf02 [router] Improve test coverage & handle case-sensitive static routes better 2021-11-16 21:26:37 -08:00
Jarred Sumner
265b1035f4 [router] Fix case sensitivity bug with route params 2021-11-16 16:57:02 -08:00
Jarred Sumner
8e0230b756 [router] Tweak sorting order & update routing tests 2021-11-16 16:33:33 -08:00
Jarred Sumner
478273e044 [router] Update router tests 2021-11-16 15:34:22 -08:00
Jarred Sumner
d0c2f5495c [internal] Fix issue with tests 2021-11-16 15:34:09 -08:00
Jarred Sumner
4a09ad51f0 [router] Fix bug with dynamic route params for route segments in the middle 2021-11-16 15:32:50 -08:00
Jarred Sumner
5bef1b46d3 [router] small cleanup 2021-11-16 15:31:47 -08:00
Jarred Sumner
3bec430192 [router] Fix edgecase with trailing slashes in directory path 2021-11-16 15:29:52 -08:00
Jarred Sumner
18f0093b18 📷 Snapshots 2021-11-15 15:59:13 -08:00
Jarred Sumner
adfaa21d03 [examples] React 18 is now beta 2021-11-15 15:59:03 -08:00
Jarred Sumner
01d1f1d258 Fix #66
embarassing!
2021-11-15 15:51:39 -08:00
Jarred Sumner
4e775d275c [bun dev] When --disable-bun.js flag is passed, don't send 500s for rendering the fallback 2021-11-15 15:47:28 -08:00
Jarred Sumner
035f6fe5e1 Bump 2021-11-15 15:40:12 -08:00
Jarred Sumner
bba74499e5 [JS Printer] Don't escape slashes 2021-11-15 15:39:21 -08:00
Jarred Sumner
b61cbb1df8 [internal] const is faster than var (in Zig! not javascript) 2021-11-15 15:39:13 -08:00
Jarred Sumner
1a60d7df98 [JS Printer] Fix bug with template literals 2021-11-15 15:38:49 -08:00
Jarred Sumner
89a7e3bf2f slightly reduce reallocations 2021-11-11 15:52:50 -08:00
Jarred Sumner
fe1a6cee10 [JSON Parser] Improve perf by 2%-4%
We warn when a JSON object has duplicate keys, but detecting duplicate keys has a cost. Now the hash table used for deduping keys is pooled instead of reallocated each time

This also removes a call to potentially resize object properties and arrays to their smallest possible size. Resizing an array can be expensive
2021-11-11 15:33:39 -08:00
Jack Hanford
6a66d9f7fb Merge pull request #64 from Jarred-Sumner/unused-vars 2021-11-10 16:08:24 -08:00
Jarred Sumner
fadbcca99c Update README.md 2021-11-10 15:48:02 -08:00
Jack Hanford
0b48e7272d remove a bunch of dead code / unused variables 2021-11-10 14:53:48 -08:00
Jarred Sumner
23bdc6f792 fixup 2021-11-09 15:50:10 -08:00
Jarred Sumner
de7274fcff fix linux build 2021-11-09 15:39:16 -08:00
Jarred Sumner
b126392a8e Fix missing symbol error for pre-macOS 11 2021-11-09 14:13:58 -08:00
Jarred Sumner
d2a9e31fd3 Bump 2021-11-09 13:05:19 -08:00
Jarred Sumner
6d61bcc4e1 Merge pull request #63 from KishanBagaria/kb/fix-catalina
clang: add -mmacosx-version-min flag
2021-11-09 13:04:12 -08:00
Kishan Bagaria
d8e3ca4a88 clang flags: add -mmacosx-version-min flag
fixes #55
2021-11-09 21:47:36 +05:30
Jarred Sumner
351184991a 📷 2021-11-08 17:42:18 -08:00
Jarred Sumner
14b51ef57c Disable Object.freeze 2021-11-08 15:53:37 -08:00
Jarred Sumner
7a836382b3 [bun-framework-next] Use WeakSet for slightly better perf 2021-11-08 15:49:28 -08:00
Jarred Sumner
360dec4fb9 Merge pull request #61 from Jarred-Sumner/tweak-bun-framework-next
Rename polyfills, polyfill Object.feeze
2021-11-08 15:47:58 -08:00
Jack Hanford
83cf1be2b9 tweak 2021-11-08 15:42:30 -08:00
Jarred Sumner
241525947c [JS Printer] Fix bug with optional chain 2021-11-08 15:37:31 -08:00
Jack Hanford
76a99eaa18 use new name 2021-11-08 13:59:53 -08:00
Jack Hanford
4bceb57ad1 rename polyfills, polyfill Object.feeze 2021-11-08 13:58:25 -08:00
Jarred Sumner
c7705a6325 Merge branch 'main' of github.com:Jarred-Sumner/bun 2021-11-07 17:00:03 -08:00
Jarred Sumner
4f78e2c47c Update Makefile 2021-11-07 17:00:00 -08:00
Jarred Sumner
6789aed119 Merge pull request #60 from Jarred-Sumner/remove-empty-file
Remove another empty file
2021-11-07 16:00:22 -08:00
Jack Hanford
291f26cba0 remove another empty file 2021-11-07 15:58:29 -08:00
Jarred Sumner
a3458ce6e3 Update package.json 2021-11-07 15:55:04 -08:00
Jarred Sumner
a7eb5397a4 Add main/module to bun-framework-next 2021-11-07 15:54:20 -08:00
Jarred Sumner
fc03ed2969 Merge pull request #59 from Jarred-Sumner/react-refresh
add react-refresh as a devDep for bun-framework-next
2021-11-07 15:47:57 -08:00
Jack Hanford
12f1991771 add react-refresh as a devDep for bun-framework-next 2021-11-07 15:44:30 -08:00
Jarred Sumner
57946e114c Merge branch 'main' of github.com:Jarred-Sumner/bun 2021-11-07 14:45:08 -08:00
Jarred Sumner
8b3463e73f [bun run] Remove unnecessary code 2021-11-07 14:45:06 -08:00
Jarred Sumner
3cb7dbe921 [resolver] Fix race condition that can cause the elapsed counter to integer overflow 2021-11-07 14:44:55 -08:00
Jarred Sumner
d11102d858 Merge pull request #58 from Jarred-Sumner/next-cleanup
misc cleanup for bun-framework-next
2021-11-07 13:18:30 -08:00
Jack Hanford
183911514a misc cleanup for bun-framework-next 2021-11-07 11:46:22 -08:00
Jarred Sumner
bc3c17ffc8 Improve ZSH completions 2021-11-07 02:41:26 -08:00
Jarred Sumner
3379289024 [bun run] Filter out builtin commands from showing up at the top 2021-11-07 02:39:31 -08:00
Jarred Sumner
562a8df46b [bun run] Filter out js files that start with . from completions 2021-11-07 02:39:01 -08:00
Jarred Sumner
68e2869d64 [bun run] Filter out post* and pre* from the completions 2021-11-07 02:38:38 -08:00
Jarred Sumner
c6818cc55c [zsh] Better zsh completions install dir guessing 2021-11-07 02:38:09 -08:00
Jarred Sumner
08b3bab2ec [internal] Generated files 2021-11-06 19:25:12 -07:00
Jarred Sumner
34771aad22 [build] Improve error messages for build failures 2021-11-06 19:24:04 -07:00
Jarred Sumner
109d53d461 [macOS] Fix minimum OS target
Closes https://github.com/Jarred-Sumner/bun/issues/55
2021-11-06 19:23:15 -07:00
Jarred Sumner
958520f557 Debug snapshots 2021-11-06 19:22:13 -07:00
Jarred Sumner
12c311da3f [internal] Fix make release on macOS arm64 2021-11-06 18:43:08 -07:00
Jarred Sumner
d7d9df726b [internal] Use a better timer for measuring parsing & resolving timings 2021-11-06 18:42:42 -07:00
Jarred Sumner
a368182769 Update Makefile 2021-11-05 17:32:00 -07:00
Jarred Sumner
2a9fd30d36 [internal] Fix the CLI flag for building with JIT permissions 2021-11-05 17:30:57 -07:00
Jarred Sumner
082a944e0b Update README.md 2021-11-05 16:11:37 -07:00
Jarred Sumner
e1b68665db Update build-id 2021-11-05 04:11:34 -07:00
Jarred Sumner
c64ef1e2f4 [resolver] Fix bug with package.json "exports" resolution with a suffix after the wildcard 2021-11-05 04:10:43 -07:00
Jarred Sumner
3063c2e64d [resolver] Add test for "exports" field with a pattern foo/*.js 2021-11-05 04:10:15 -07:00
Jarred Sumner
38f46169d9 📷 Snapshots 2021-11-05 04:09:41 -07:00
Jarred Sumner
c1aa0323dc [bun run] Fix issue with \\" \\" in scripts 2021-11-05 04:09:27 -07:00
Jarred Sumner
673b755987 Update README.md 2021-11-05 02:52:16 -07:00
Jarred Sumner
3d6fab6e49 📷 Snapshots 2021-11-05 01:33:09 -07:00
Jarred Sumner
d0823beef5 Update run_command.zig 2021-11-05 01:23:07 -07:00
Jarred Sumner
b0e98892e5 [bun run] Exclude .config.* files from showing up as runnable with Bun.js 2021-11-05 01:22:48 -07:00
Jarred Sumner
0006d28cbb 📷 Snapshots 2021-11-05 01:16:19 -07:00
Jarred Sumner
42dcc4e217 Bump 2021-11-05 01:15:43 -07:00
Jarred Sumner
13582981e4 Update bun.fish 2021-11-05 01:15:35 -07:00
Jarred Sumner
d4c1bf6c67 [bun run] Fix bug with yarn getting replaced for - commands 2021-11-05 01:15:24 -07:00
Jarred Sumner
3ef55d10ae [bun run] Improve fish completions by adding a description 2021-11-05 01:15:09 -07:00
Jarred Sumner
5ce171d92c [bun run][bun create] Do not follow symlinks when exec'ing a child process 2021-11-04 21:37:10 -07:00
Jarred Sumner
e409148941 [bun run] Fix bug with quotes and spaces
Fixes #53
2021-11-04 21:00:44 -07:00
Jarred Sumner
d44abd8e4d Update string_immutable.zig 2021-11-04 18:41:40 -07:00
Jarred Sumner
5c38b6c355 [internal] fmt 2021-11-04 18:33:14 -07:00
Jarred Sumner
04ecfdd794 [JS Parser] Print � for invalid WTF-8 input 2021-11-04 18:33:00 -07:00
Jarred Sumner
fc59a32b63 [JS Parser] Decode JavaScript-like input as WTF-8 instead of UTF-8 2021-11-04 18:30:43 -07:00
Jarred Sumner
fd57e2d9a6 [JSX] Match esbuild behavior for multiline JSX string literals 2021-11-04 15:27:29 -07:00
Jarred Sumner
303a5ea898 [JSX] Fix regression with JSX entities 2021-11-03 19:29:07 -07:00
Jarred Sumner
d502d0bcd6 Update install.sh 2021-11-03 15:26:06 -07:00
Jarred Sumner
2018f5020a [installer] Detect rosetta in install.sh 2021-11-03 15:25:38 -07:00
Jarred Sumner
92a7849e98 [Bun.js] Rename Bun.sleep -> Bun.sleepSync 2021-11-03 02:04:21 -07:00
Jarred Sumner
59bdb62966 Fix next version warning 2021-11-03 01:20:08 -07:00
Jarred Sumner
eab1938012 [bun create] Auto-set to Next.js v12.0.2 2021-11-03 00:27:13 -07:00
Jarred Sumner
d97bd79c86 Bump once again (bun create requires git-public versions) 2021-11-03 00:23:49 -07:00
Jarred Sumner
35c05f61e5 Bump next version 2021-11-03 00:22:37 -07:00
Jarred Sumner
a5181c8ed1 [examples] Display Next.js version in example 2021-11-02 23:43:20 -07:00
Jarred Sumner
aa545ac0dc Update README.md 2021-11-02 23:37:57 -07:00
Jarred Sumner
ac9bd094f3 [test] Make sure we curl a jsx file in react integration test 2021-11-02 23:25:31 -07:00
Jarred Sumner
becf55febc Bump examples 2021-11-02 23:25:08 -07:00
Jarred Sumner
c41cc80700 [internal] Undo workspace commits, turns out it's not necessary for now 2021-11-02 23:17:25 -07:00
Jarred Sumner
20b1a27d05 [bun-macro-relay] Temporary fix until .d.ts is handled more correctly 2021-11-02 23:16:52 -07:00
Jarred Sumner
a027e9b6bc v0.1.1 2021-11-02 23:16:33 -07:00
Jarred Sumner
3fe676e9c9 Bump versions 2021-11-02 23:13:18 -07:00
Jarred Sumner
bffe8e918b Merge branch 'jarred/package-mapper' of github.com:Jarred-Sumner/bun into jarred/package-mapper 2021-11-02 23:10:43 -07:00
Jarred Sumner
92e5fe9fd5 Next.js 12 support 2021-11-02 23:10:40 -07:00
Jarred Sumner
b107ac1659 [internal] Inline empty function 2021-11-02 22:53:53 -07:00
Jarred Sumner
5537c03569 Fixes https://github.com/Jarred-Sumner/bun/issues/28 2021-11-02 22:53:26 -07:00
Jarred Sumner
4ab7c82405 Revert "[bundler] Start detecting workspace roots"
This reverts commit e71cb5c8c9.
2021-11-02 22:53:06 -07:00
Jarred Sumner
6e8cd2e3e5 [bun bun] alwaysBundled packages should use their real paths 2021-11-02 22:52:38 -07:00
Jarred Sumner
c0c7527497 [parser] Fix undefined behavior when invalid an unicode codepoint is part of an error message 2021-11-02 22:48:48 -07:00
Jarred Sumner
e71cb5c8c9 [bundler] Start detecting workspace roots 2021-11-02 18:09:54 -07:00
Jarred Sumner
cdbb4cf68a [interla] Comment 2021-11-02 18:08:55 -07:00
Jarred Sumner
204d468ad2 [internal] Global.configureAllocator() 2021-11-02 18:07:11 -07:00
Jarred Sumner
1844212f34 [bundler] Start detecting workspace roots 2021-11-02 17:20:45 -07:00
Jarred Sumner
fbb0342511 [CLI] Fix completions auto-installer for zsh 2021-11-01 21:23:47 -07:00
Jarred Sumner
92b174b315 Add Bun.js integration tests, but don't run them yet. 2021-11-01 20:05:38 -07:00
Jarred Sumner
0ba9784be2 [cli] Hardcode some paths to install for zsh 2021-11-01 06:10:13 -07:00
Jarred Sumner
2c50cf7284 Update Makefile 2021-11-01 04:57:50 -07:00
Jarred Sumner
bea0dca55d Update Makefile 2021-11-01 04:56:30 -07:00
Jarred Sumner
1676af9de9 [cli] Slightly improve zsh completions 2021-11-01 04:41:46 -07:00
Jarred Sumner
3d48bdaad1 Delete node_modules.jsbundle 2021-11-01 04:30:59 -07:00
Jarred Sumner
1b474d4f97 [CLI] Spacing 2021-11-01 04:30:31 -07:00
Jarred Sumner
4467167f99 [cli] just open the directory, access is dumb 2021-11-01 04:27:44 -07:00
Jarred Sumner
36ec8bb99b [test] Add integration test for null byte \\0 2021-11-01 04:04:48 -07:00
Jarred Sumner
bc5f99dc43 [internal] Tiny changes that will eventually make it easier to update zig 2021-11-01 04:04:18 -07:00
Jarred Sumner
4d4966592e [upgrade] Reinstall completions on bun upgrade 2021-11-01 04:03:43 -07:00
Jarred Sumner
f1fff3af7e Bump 2021-11-01 03:59:48 -07:00
Jarred Sumner
83e553d6a9 [install] Auto-set PATH if possible 2021-11-01 03:59:36 -07:00
Jarred Sumner
173724b402 [CLI] Add zsh completions and auto-install completions 2021-11-01 03:43:27 -07:00
Jarred Sumner
64d3927879 [CLI] Add completions for Fish 2021-10-31 21:02:15 -07:00
Jarred Sumner
49ad70b11c [CLI] Print newline after --version 2021-10-31 16:19:28 -07:00
Jarred Sumner
0d0b769bcc Add -v shorthand for version 2021-10-31 16:19:15 -07:00
Jarred Sumner
fb2aa186b7 [Bun.js] Bun.sleep() lets you synchronously sleep. Thanks @evanwashere 2021-10-31 00:39:37 -07:00
Jarred Sumner
ef94826f95 [CLI] Fix spacing (thanks @KishanBagaria) 2021-10-31 00:22:03 -07:00
Jarred Sumner
d79f34e960 Update cli.zig 2021-10-30 23:15:55 -07:00
Jarred Sumner
4ce6e4a9cb [Bun.js] Ensure we print in Latin1 mode 2021-10-30 23:15:47 -07:00
Jarred Sumner
9cf2771549 Update javascript.zig 2021-10-30 23:14:58 -07:00
Jarred Sumner
daf583e4cb [Bun.js] Lazily add FORCE_COLOR environment variable for better compatibility with Node.js modules that detect whether the terminal supports colors 2021-10-30 23:14:48 -07:00
Jarred Sumner
51e55f4b6e [Bun.js] Partially fix loading Node.js fallback modules 2021-10-30 23:14:14 -07:00
Jarred Sumner
f30527b6d9 [Bun.js] Add API for detecting if ANSI colors are enabled 2021-10-30 23:13:17 -07:00
Jarred Sumner
17b186933d [Bun.js] Implement supports-color polyfill (so that chalk works) 2021-10-30 23:12:11 -07:00
Jarred Sumner
fd57edceff [Bun.js] fix node fetch polyfills 2021-10-30 23:11:43 -07:00
Jarred Sumner
1876c0e11a Fixes #34 2021-10-30 21:44:31 -07:00
Jarred Sumner
cd5c740368 [internal] Fix loading runtime code in debug builds 2021-10-30 20:53:08 -07:00
Jarred Sumner
e2eef2bb25 [internal] Makefile 2021-10-30 19:24:42 -07:00
Jarred Sumner
ad3c19a160 Linking instructions in Makefile 2021-10-30 18:20:53 -07:00
Jarred Sumner
07bb25f7b1 Update Makefile 2021-10-30 18:16:15 -07:00
Jarred Sumner
edd0223377 Update README.md 2021-10-30 18:15:31 -07:00
Jarred Sumner
34a8a623f4 Update README.md 2021-10-30 18:12:31 -07:00
Jarred Sumner
f854539ea9 Update README.md 2021-10-30 18:09:50 -07:00
Jarred Sumner
cd1b8ccde7 Update Makefile 2021-10-30 18:05:35 -07:00
Jarred Sumner
cf3f8d2bb0 Update Makefile 2021-10-30 18:04:11 -07:00
Jarred Sumner
f1a0e718b3 Update Makefile 2021-10-30 17:55:14 -07:00
Jarred Sumner
08e0a51036 Add prettier to makefile & package.json 2021-10-30 17:48:04 -07:00
Jarred Sumner
8e0f21cc91 [internal] Make zig and npm client possibly environment variables 2021-10-30 17:45:22 -07:00
Jarred Sumner
ae7843f244 Fix make require 2021-10-30 17:37:03 -07:00
Jarred Sumner
b5b47e6525 Update README.md 2021-10-30 17:24:53 -07:00
Jarred Sumner
e7a4f9f507 [internal] generate .zip for release in Linux was missing filepath 2021-10-30 16:21:37 -07:00
Jarred Sumner
658926189f Update README.md 2021-10-30 16:21:08 -07:00
Jarred Sumner
154c8372e3 [Bun.js] Call JSCInitialize() before starting 2021-10-30 05:01:47 -07:00
Jarred Sumner
a68b5eef86 [Bun.js] Enable SharedArrayBuffer 2021-10-30 04:52:15 -07:00
Jarred Sumner
65ea1e4647 [Bun.js] Fix entry point to only call default if it was a CommonJS transformed function 2021-10-30 03:11:58 -07:00
Jarred Sumner
f8f85430c0 [internal] gitignore blobs for identifier cache 2021-10-30 01:49:19 -07:00
Jarred Sumner
d8a2eb81e3 [internal] Add identifier-cache to makefile so we don't forget to run it 2021-10-30 01:48:58 -07:00
Jarred Sumner
9a9c0df6b0 [lexer] Fix crash on legacy octal literals 2021-10-30 01:28:27 -07:00
Jarred Sumner
0a86beccc7 Bump build id 2021-10-30 01:27:50 -07:00
Jarred Sumner
2fe9791127 Update CHANGELOG.md 2021-10-30 01:23:21 -07:00
Jarred Sumner
b856d50c3f Update CHANGELOG.md 2021-10-30 01:19:41 -07:00
Jarred Sumner
dde2b80e1d Update CHANGELOG.md 2021-10-30 01:19:15 -07:00
Jarred Sumner
49b954462d [Bun.js] Add performance.now() 2021-10-30 01:19:10 -07:00
Jarred Sumner
c51dac1282 [internal] Fix build issue with the JavaScriptCore bindings on macOS. GNU sed != BSD sed 2021-10-29 23:41:43 -07:00
Jarred Sumner
0d002c7057 [bun run] Support running JavaScript, TypeScript, JSX, and TSX files using Bun.js 2021-10-29 23:41:06 -07:00
Jarred Sumner
1d03e90b5c [internal] This is no longer a feature flag in JSC 2021-10-29 23:37:29 -07:00
Jarred Sumner
25ac773cf3 [Bun.js] Add support for Top Level Await! 2021-10-29 23:36:55 -07:00
Jarred Sumner
ecb069ac85 [internal] Normalize import filepaths 2021-10-29 23:36:00 -07:00
Jarred Sumner
a6cf6c4069 [Bun.js] Fix silly oversight with fetch implementation 2021-10-29 23:35:06 -07:00
Jarred Sumner
6854d83842 [internal] Fix missing symbol errors when building JavaScriptCore bindings without already having the object files 2021-10-29 23:34:19 -07:00
Jarred Sumner
4aab78f619 [internal] Improve Bun's debug build times 2021-10-29 23:32:30 -07:00
Jarred Sumner
95d2860930 Add integration test that verifies bash exported functions work in bun run 2021-10-29 19:17:44 -07:00
Jarred Sumner
70db76a798 Pass through environment variables from the process verbatim
Fixes https://github.com/Jarred-Sumner/bun/issues/40
2021-10-29 18:35:42 -07:00
Jarred Sumner
07bf3eb1e9 Merge pull request #41 from mikeroelens/mikeroelens/fix-shell-install-command 2021-10-29 15:39:36 -07:00
Mike Roelens
237e672e70 fix: add missing quotation in sample zsh config 2021-10-29 15:14:02 -04:00
Jarred Sumner
61d436c29d https:// for the URL 2021-10-29 08:21:30 -07:00
Jarred Sumner
22ea3e76f9 Update README.md 2021-10-28 21:40:25 -07:00
Jarred Sumner
0089d04459 Update README.md 2021-10-28 21:18:48 -07:00
Jarred Sumner
26ee46ad5b Bump 2021-10-28 19:05:27 -07:00
Jarred Sumner
417c4e0faa - Fix consistentcy issue with runtime hash
- Fix edgecases in strings.eqlComptime by simplifying the implementation
2021-10-28 19:03:49 -07:00
Jarred Sumner
b6675dd0ab Explicitly check content type 2021-10-28 17:33:40 -07:00
Jarred Sumner
dff40c5220 FIx webkit commit 2021-10-28 17:08:28 -07:00
Jarred Sumner
1fd426432e Fix spacing, add check that the version matches before we push 2021-10-28 17:06:42 -07:00
Jarred Sumner
97c43ef787 Don't run bun upgrade in the makefile 2021-10-28 17:02:27 -07:00
Jarred Sumner
a546e56669 Update Makefile 2021-10-28 16:55:22 -07:00
Jarred Sumner
4b52192974 Update upgrade_command.zig 2021-10-28 16:52:57 -07:00
Jarred Sumner
fb10e0c4cb Upgrade checker + polish for bun upgrade 2021-10-28 16:39:26 -07:00
Jarred Sumner
a44cb9708f New subcommand: bun upgrade. It upgrades bun to the latest version. 2021-10-28 05:34:38 -07:00
Jarred Sumner
c7fc08056a part 1 of try to fix the npm install process 2021-10-27 17:38:05 -07:00
Jarred Sumner
12ba37e43a Update build-id 2021-10-27 15:27:03 -07:00
Jarred Sumner
928346b842 Verify package installs successfully for each platform 2021-10-27 15:26:04 -07:00
Jarred SUmner
b81c895e1d Add test that verifies installing bun with yarn & npm works before publishing 2021-10-27 04:26:38 -07:00
Jarred Sumner
d434e5aeac Make the installation more careful 2021-10-27 04:12:13 -07:00
Jarred Sumner
2250db41b4 Add universal macOS build so that Bun works on rosetta builds of Node.js 2021-10-27 02:41:45 -07:00
Jarred Sumner
826db9021e Before publishing the binary to npm, verify it installs successfully and it's the expected version 2021-10-27 01:42:50 -07:00
Jarred Sumner
ad61279621 Fix aarch64 build errors 2021-10-27 01:22:02 -07:00
Jarred Sumner
5ce1b36130 Choose different clang for macOS and Linux 2021-10-26 22:57:49 -07:00
Jarred SUmner
a1f17f70eb Suggest running tests in build instructions 2021-10-26 22:38:36 -07:00
Jarred SUmner
a0f086ba85 Fix Linux x64 build 2021-10-26 22:37:03 -07:00
Jarred Sumner
8d095a235f Add test that checks JIT is enabled for JavaScriptCore and crashes if it isn't 2021-10-26 19:07:37 -07:00
Jarred Sumner
ff1417421b Simple integration test for bun run 2021-10-26 19:06:45 -07:00
Jarred Sumner
00fb04f309 Update Makefile 2021-10-26 18:47:43 -07:00
Jarred Sumner
a3cc17fbe6 Add a very simple integration test for bun create next & bun create react 2021-10-26 18:46:53 -07:00
Jarred Sumner
fd27d403d7 Aligning text in terminals is tedious 2021-10-26 17:48:33 -07:00
Jarred Sumner
6d29e314a0 Switch to using optionalDependencies for installing the packages instead of a postinstall script.
Sorry yarn v1 users :(
2021-10-26 17:37:44 -07:00
Jarred Sumner
902e438e6c Update README.md 2021-10-26 17:26:45 -07:00
Jarred Sumner
096d668d83 Bun is now a task runner as well 2021-10-26 17:24:09 -07:00
Jarred Sumner
49c5c32714 More spacing 2021-10-26 17:19:45 -07:00
Jarred Sumner
9a70d8daa2 Update README.md 2021-10-26 17:15:35 -07:00
Jarred Sumner
79eb8d9d78 Update README.md 2021-10-26 17:12:22 -07:00
Jarred Sumner
221b280856 spacing 2021-10-26 17:09:38 -07:00
Jarred Sumner
933378ab80 Update README.md 2021-10-26 16:58:57 -07:00
Jarred Sumner
bd51d194cf Add .cjs, .mts, and .cts to the list of file extensions to check for imports 2021-10-26 16:58:51 -07:00
Jarred Sumner
1e27c7d8ce [bun run] Add to README 2021-10-26 16:49:48 -07:00
Jarred Sumner
7d554ed175 [bun run] Fix passthrough behavior 2021-10-26 16:49:34 -07:00
Jarred Sumner
e72d765961 Spacing 2021-10-26 16:18:57 -07:00
Jarred Sumner
9ce38b86ab Fix edgecase with options loading attempting to create an output directory when it shouldn't 2021-10-26 16:18:51 -07:00
Jarred Sumner
05bdda7b07 Update clap.zig 2021-10-26 15:47:14 -07:00
Jarred Sumner
d68f18c77a [bun run] Add node_modules/.bin in reverse order, print failure on exit code 2021-10-26 15:47:08 -07:00
Jarred Sumner
ae6349e573 [.env loader] Fix bug with PATH values sometimes getting cut off at the end by one character 2021-10-26 15:30:26 -07:00
Jarred Sumner
0541cff2ad New subcommand: bun run run scripts in package.json really fast 2021-10-26 05:18:21 -07:00
Jarred Sumner
e69f8c36d2 [router] Don't log the route names since that's not necessary anymore 2021-10-25 17:06:38 -07:00
Jarred Sumner
e7f191c08b [HTTP] Fix error handling modal from showing when there are no errors 2021-10-25 17:06:20 -07:00
Jarred Sumner
6a2372b0b2 Fix rendering with Next.js after latest changes to route api 2021-10-25 17:05:59 -07:00
Jarred Sumner
0592515639 [HTTP Server] Add flag for disabling Bun.js 2021-10-25 17:05:10 -07:00
Jarred Sumner
a6c4bba6c2 [JSON loader] Fix importing JSON in ESM modules 2021-10-25 17:04:52 -07:00
Jarred Sumner
5691bf385b [.env loader] Add CLI flag to dump loaded environment variables as JSON 2021-10-25 17:04:32 -07:00
Jarred Sumner
a149f0abb9 Update build-id 2021-10-25 06:17:20 -07:00
Jarred Sumner
eae7051111 Add snapshots for latin1 regexp, add more codepoints to string escapes 2021-10-25 06:17:16 -07:00
Jarred Sumner
adb6be05d1 Use PNPM in Makefile 2021-10-25 06:16:31 -07:00
Jarred Sumner
4e889c7b47 Fix JSX unicode handling, slightly improve perf 2021-10-25 05:42:01 -07:00
Jarred Sumner
2ed6605cc3 [Bun.js] When Body is UTF-16 encoded, convert it to UTF-8. 2021-10-25 04:46:01 -07:00
Jarred Sumner
42c264bf7b Fix all known string encoding bugs 2021-10-25 00:52:07 -07:00
Jarred Sumner
fe6564b533 finish Expr.alloc -> Expr.init 2021-10-24 17:12:30 -07:00
Jarred Sumner
f6923f21b1 [internal] only set source for test once 2021-10-24 17:00:51 -07:00
Jarred Sumner
edfc61889c Mark all exported symbols as weak, always zig fmt the headers file to reduce diff churn 2021-10-24 17:00:21 -07:00
Jarred Sumner
08c8ca18a7 [internal] Get source URLs in C++ 2021-10-24 16:54:37 -07:00
Jarred Sumner
9e4f16ac8b ^ 2021-10-24 16:52:16 -07:00
Jarred Sumner
03ece0568d Expr.alloc -> Expr.init 2021-10-24 16:51:39 -07:00
Jarred Sumner
2dcb465d50 Upgrade to latest peechy 2021-10-24 16:48:47 -07:00
Jarred Sumner
c93655c717 Fix build error 2021-10-24 16:11:06 -07:00
Jarred Sumner
6f6510169e [JSON] Use a special lexer variant only for JSON 2021-10-24 16:09:15 -07:00
Jarred Sumner
cfe159f636 [internal] Remove more unused code and move the is_ascii_only boolean to only update for JSON parsing 2021-10-24 16:07:47 -07:00
Jarred Sumner
213f361551 [internal] Handle allocation failure 2021-10-24 15:55:27 -07:00
Jarred Sumner
3582941791 [internal] Use isPresent() instead of checking slice len 2021-10-24 15:53:27 -07:00
Jarred Sumner
a3cd9347e6 ✂️ Dead code 2021-10-24 15:53:02 -07:00
Jarred Sumner
449c8b5f36 [internal] Tweak build system to better support unit tests in Zig 2021-10-24 06:18:42 -07:00
Jarred Sumner
1f7af3754d [picohttp] failing test 2021-10-24 06:11:06 -07:00
Jarred Sumner
72df6b9be2 [.env loader] Environment variables are strings. 2021-10-24 06:10:53 -07:00
Jarred Sumner
044c0cfdc3 [internal] more inlining 2021-10-24 06:08:32 -07:00
Jarred Sumner
3c43f65234 [internal] ✂️ dead code 2021-10-24 06:08:08 -07:00
Jarred Sumner
bd2d284c53 [internal] some inlining 2021-10-24 06:07:39 -07:00
Jarred Sumner
ffea9c010b [internal] :snowflake: 2021-10-24 06:05:36 -07:00
Jarred Sumner
44351b57f7 [.env loader] Tests pass 2021-10-24 06:04:42 -07:00
Jarred Sumner
4bbb938de8 Comment out WASM test since WASM is currently unsupported 2021-10-23 22:57:01 -07:00
Jarred Sumner
437270e0af Remove very outdated tests 2021-10-23 22:56:35 -07:00
Jarred Sumner
09b7f4c95d Remove unused feature flag parallel_bun 2021-10-23 22:56:20 -07:00
Jarred Sumner
38f83c50c4 Add flag for dumping the environment variables 2021-10-23 22:55:47 -07:00
Jarred Sumner
2f06dc5755 [internal] Add easier commands for running unit tests 2021-10-23 22:55:26 -07:00
Jarred Sumner
d6b66e2155 Handle edgecase when returning errors 2021-10-23 22:54:56 -07:00
Jarred Sumner
309298fa42 Fix bug with MutableString.ensureValidIdentifier 2021-10-23 22:54:39 -07:00
Jarred Sumner
a0a2fa964b [internal] Remove more dead code, add script to find .zig files that aren't imported by other .zig files 2021-10-23 16:48:12 -07:00
Jarred Sumner
0c769d0f61 No more iguanaTLS 2021-10-23 16:15:44 -07:00
Jarred Sumner
1b90619890 [internal] ✂️ dead code 2021-10-23 16:15:36 -07:00
Jarred Sumner
0ea34216de Load environment variables into defines when possible 2021-10-23 05:04:08 -07:00
Jarred Sumner
53374ac54a [Bundler] When modules fail to resolve, continue building so that you can see many errors without re-running Bun 2021-10-23 05:03:26 -07:00
Jarred Sumner
6355ac219e [JS Parser] Parser errors should _always_ report an error location 2021-10-23 05:02:26 -07:00
Jarred Sumner
384ad96637 Support string-only defines 2021-10-23 05:00:31 -07:00
Jarred Sumner
0361b0df70 [.env loader] Parse values as JavaScript string literals instead of JSON 2021-10-23 05:00:14 -07:00
Jarred Sumner
a1b8c20c3f Add "process.env" to global object 2021-10-23 04:59:03 -07:00
Jarred Sumner
de01d581c1 Rewrite the CodepointIterator to fix some bugs 2021-10-23 04:58:20 -07:00
Jarred Sumner
f1bda194e0 [Lexer] Improve lexing performance by 2% via a bitfield for checking identifiers, inlining functions, and moving some branches to comptime 2021-10-23 04:57:34 -07:00
Jarred Sumner
a84b62452c [Bun.js] Escape unicode identifiers. This is necessary because we load source code into JavaScriptCore as latin1 to conserve memory. Loading as UTF-16 means your code uses 2x as much memory. 2021-10-23 04:56:09 -07:00
Jarred Sumner
e039ba5130 [Bun.js] Add Bun.env and support process.env for non-transpiled environment variables 2021-10-23 04:54:17 -07:00
Jarred Sumner
e67dd8947b [lexer] 0x200C and 0x200D are valid ID_Continue characters 2021-10-21 04:31:30 -07:00
Jarred Sumner
2d6a4a4956 Split tests into separate .json file 2021-10-21 04:30:50 -07:00
Jarred Sumner
f394581ed8 Add test for non-ascii latin1 characters in strings 2021-10-21 04:30:44 -07:00
Jarred Sumner
33b0c89e7c [Bun.js] Fix SyntaxError not showing source file or line number 2021-10-21 04:27:36 -07:00
Jarred Sumner
4e3aa3c289 Fix index + static route 2021-10-20 05:12:01 -07:00
Jarred Sumner
58b196c583 rewrote most of the router 2021-10-20 04:18:29 -07:00
Jarred Sumner
3dc53c3d13 Starting to rewrite the router to fix some bugs and support catch-all + optional routes 2021-10-18 23:55:17 -07:00
Jarred Sumner
4f2c1cfe85 Update README.md 2021-10-17 18:40:54 -07:00
Jarred Sumner
6e16b3cf84 Bump to latest 2021-10-17 15:36:52 -07:00
Jarred Sumner
9f0ab479b0 [bun-framework-next] Fix when the project does not define a _app page 2021-10-17 15:36:28 -07:00
Jarred Sumner
884b5e13ee Add --open flag to bun create 2021-10-17 03:42:03 -07:00
Jarred Sumner
7d4aab4cf1 Slight cleanup 2021-10-17 03:41:31 -07:00
Jarred Sumner
6bb0c03d8d Update README.md 2021-10-16 23:56:50 -07:00
Jarred Sumner
797c94b0e9 Update README.md 2021-10-16 23:52:57 -07:00
Jarred Sumner
e63fbcefe9 bump! 2021-10-16 23:49:39 -07:00
Jarred Sumner
dcc29d3db6 Improve support for Create React App 2021-10-16 23:24:23 -07:00
Jarred Sumner
be66c01829 Update js_ast.zig 2021-10-16 21:33:09 -07:00
Jarred Sumner
21b9884606 Support GitHub repositories, transform package.json to better fit Bun's usage 2021-10-16 21:33:05 -07:00
Jarred Sumner
fd6d93292c more strings 2021-10-16 20:23:37 -07:00
Jarred Sumner
9000165718 Ensure self is always defined 2021-10-16 20:23:25 -07:00
Jarred Sumner
54b313cc5a Fix edgecase in Transfer-Encoding chunked 2021-10-16 20:23:06 -07:00
Jarred Sumner
2461c11536 Cleanup 2021-10-15 23:36:30 -07:00
Jarred Sumner
f17345ffe4 Bump the version 2021-10-15 23:05:58 -07:00
Jarred Sumner
4908a63f61 Latest 2021-10-15 23:03:31 -07:00
Jarred Sumner
da7de899e1 📷 2021-10-15 23:02:40 -07:00
Jarred Sumner
44108d6a26 Fix static libarchive build 2021-10-15 22:52:24 -07:00
Jarred Sumner
c7fb978b7b Merge branch 'main' of github.com:Jarred-Sumner/bun 2021-10-15 22:37:29 -07:00
Jarred Sumner
0db94d94d6 Bump s2n-tls 2021-10-15 22:36:28 -07:00
Jarred SUmner
92e489760d Linux build fixes 2021-10-15 22:33:36 -07:00
Jarred Sumner
decee7616f Update Makefile 2021-10-15 20:33:35 -07:00
Jarred Sumner
deafd3d0d4 Cleanup makefile to get libiconv setup for linux 2021-10-15 20:25:23 -07:00
Jarred Sumner
b9bbd819be Update Makefile 2021-10-15 20:14:55 -07:00
Jarred Sumner
b956ea5a5e Update Makefile 2021-10-15 20:13:18 -07:00
Jarred Sumner
cf2e81b036 Merge branch 'jarred/gen' 2021-10-15 20:08:40 -07:00
Jarred Sumner
bf2732599c update makefile 2021-10-15 20:08:21 -07:00
Jarred Sumner
10696680ff Polish 2021-10-15 19:44:53 -07:00
Jarred Sumner
7e159cb5cd ❇️ 2021-10-14 22:10:08 -07:00
Jarred Sumner
74cda61c88 Update README.md 2021-10-14 19:17:44 -07:00
Jarred Sumner
9dfe57a3f7 Update README.md 2021-10-14 19:17:20 -07:00
Jarred Sumner
f10dcd780c Update README.md 2021-10-14 19:08:55 -07:00
Jarred Sumner
bee7efb5d9 Update README.md 2021-10-14 19:07:40 -07:00
Jarred Sumner
0039b53d21 Update README.md 2021-10-14 19:01:51 -07:00
Jarred Sumner
9f86acbe58 Update README.md 2021-10-14 18:58:50 -07:00
Jarred Sumner
bbc1bcbed1 Support local templates 2021-10-14 18:55:41 -07:00
Jarred Sumner
3ed824fe0f Update router.zig 2021-10-14 16:15:04 -07:00
Jarred Sumner
fe24b96d61 Support passing an absolute path 2021-10-14 16:14:48 -07:00
Jarred Sumner
4b6d8a152f Update bun-create.md 2021-10-14 14:51:51 -07:00
Jarred Sumner
e21b9afdf2 Update bun-create.md 2021-10-14 14:50:34 -07:00
Jarred Sumner
901d7d8759 Add doc explaining bun-create 2021-10-14 14:49:48 -07:00
Jarred Sumner
4b618f9ad1 bun create react app is almost done 2021-10-14 05:22:47 -07:00
Jarred Sumner
0f7bc76f39 v0.0.0 2021-10-13 23:13:58 -07:00
Jarred Sumner
6d997ab201 [fetch] Slight perf improvement 2021-10-13 14:29:03 -07:00
Jarred Sumner
8f7f4ae72f --turbo mode for fetch cli, which disables sending TLS shutdown 2021-10-13 14:17:23 -07:00
Jarred Sumner
c85b5f6a87 [fetch] Support Transfer-Encoding: chunked 2021-10-13 14:06:51 -07:00
Jarred Sumner
ba5f9887fb Update build.zig 2021-10-13 00:28:31 -07:00
Jarred Sumner
9e3e9a2d6d Clean up examples a little 2021-10-13 00:28:20 -07:00
Jarred Sumner
88a5e2d34d Add TLS 1.3 support, improve fetch() HTTPS performance 2021-10-13 00:27:35 -07:00
Jarred Sumner
afc346d6f1 s2n.zig 2021-10-12 16:27:32 -07:00
Jarred Sumner
4dd398ca7a ignore = dirty 2021-10-12 16:27:15 -07:00
Jarred Sumner
756bfc9077 Add fetch CLI test app 2021-10-12 16:26:57 -07:00
Jarred Sumner
f646250a91 Add s2n, remove openssl 2021-10-12 16:26:24 -07:00
Jarred Sumner
24c567086f Add OpenSSL 😢 2021-10-11 20:15:15 -07:00
Jarred Sumner
05b1696df7 Add libarchive bindings 2021-10-11 18:31:24 -07:00
Jarred Sumner
0baa3b511e Update README.md 2021-10-11 02:34:54 -07:00
Jarred Sumner
d793088575 Update README.md 2021-10-11 02:34:41 -07:00
Jarred Sumner
9aa7f9ed18 link to fork 2021-10-11 02:33:35 -07:00
Jarred Sumner
e7f6cf12a5 Update .gitmodules 2021-10-10 23:41:49 -07:00
Jarred Sumner
e2ba468924 Update .gitmodules 2021-10-10 23:41:40 -07:00
Jarred Sumner
85760c0a4c Missing fixture 2021-10-10 23:41:27 -07:00
Jarred Sumner
0db7af6166 [fetch] Add support for gzip & deflate to the http client
Powered by Cloudflare's zlib fork
2021-10-10 23:41:18 -07:00
Jarred Sumner
5e3d1dd4b5 Merge pull request #30 from alexkuz/patch-1 2021-10-09 03:47:24 -07:00
Alexander Kuznetsov
6eb9a36a22 Fetch WebKit submodule via https instead of ssh
Fetching submodule via ssh leads to auth error if SSH key is not provided in GitHub settings; all submodules left uninitialized as a result
2021-10-09 11:50:14 +03:00
Jarred Sumner
e88e9401f1 Fix bug where occasionally unary expressions would simplify incorrectly due to an undefined memory issue 2021-10-08 17:24:03 -07:00
Jarred Sumner
829b4287dd Yet Another Packed Struct Bug 2021-10-08 15:48:58 -07:00
Jarred Sumner
2bf7b5a7ab Update readme.md 2021-10-07 22:31:36 -07:00
Jarred Sumner
1c83f3091c Update README.md 2021-10-07 21:31:52 -07:00
Jarred Sumner
dfd08e7c55 Fix potential symbol collision in bun-macro-relay 2021-10-07 21:31:11 -07:00
Jarred Sumner
3b28af17db Fix edgecase when bundling JavaScript that references ESM exported functions before they're defined 2021-10-07 21:30:28 -07:00
Jarred Sumner
5a03dfb9a4 Schema 2021-10-07 21:29:16 -07:00
Jarred Sumner
fa1aa301e8 Add --port CLI flag for setting a port instead of --origin. --port has higher precedence than --origin so that proxies can work 2021-10-07 21:29:07 -07:00
Jarred Sumner
ae7b91efe2 Add CSS HMR benchmark 2021-10-07 21:27:47 -07:00
Jarred Sumner
6d9ccd9b8e Fix package.json file 2021-10-06 20:02:58 -07:00
Jarred Sumner
0d79435ce2 Snapshots 2021-10-06 20:02:40 -07:00
Jarred Sumner
4ee2fdf1c6 uname 2021-10-06 19:32:32 -07:00
Jarred Sumner
cd273daa1b Missing @TypeOf 2021-10-06 19:31:19 -07:00
Jarred Sumner
c2e9d49f69 oops 2021-10-06 19:29:50 -07:00
Jarred Sumner
38a9c92eec Bump it 2021-10-06 19:28:44 -07:00
Jarred Sumner
1d0f442718 📷 2021-10-06 19:26:43 -07:00
Jarred Sumner
1e8babe185 HTTP paths must resolve from ./$PROJECT_ROOT unless explicitly marked absolute.
This fixes the issue with deeply nested PNPM workspace packages. Happened when using @emotion/react inside a PNPM workspace when @emotion/react was hoisted to the workspace root but react was in a child node_modules folder. It would fail to resolve `"react/jsx-dev-runtime"` because it didn't exist in any node_modules folder relative to `@emotion/react`'s real path.
2021-10-06 19:26:28 -07:00
Jarred Sumner
69d3b5ca60 Update browser.js 2021-10-06 19:21:34 -07:00
Jarred Sumner
a493c18193 Fix JSX transform edgecase with static children 2021-10-06 19:21:26 -07:00
Jarred Sumner
5370ea71c0 Add support for reading JSX config from tsconfig.json 2021-10-06 16:49:26 -07:00
Jarred Sumner
0afec7739b Update README.md 2021-10-05 23:09:57 -07:00
Jarred Sumner
a7173d54ce Update README.md 2021-10-05 23:08:11 -07:00
Jarred Sumner
3b10cfae80 analytics is good enough for now 2021-10-05 23:08:06 -07:00
Jarred Sumner
bd14ad9e6e Async analytics works now
Requests are ~60 bytes and the thread mostly sleeps, so it should be pretty low overhead overall.
2021-10-05 17:50:05 -07:00
Jarred Sumner
9507cd8ed6 [fetch] Fix bug with HTTP request bodies 2021-10-05 17:45:32 -07:00
Jarred Sumner
dfe74cb5c4 Add BUN_DISABLE_ANALYTICS flag to disable analytics and automatically disable analytics when running inside hyperfine 2021-10-05 03:11:35 -07:00
Jarred Sumner
00e7b7c3d5 Simple analytics 2021-10-05 02:27:49 -07:00
Jarred SUmner
d2be50bf4d Merge branch 'main' of github.com:Jarred-Sumner/bun into main 2021-10-04 20:42:17 -07:00
Jarred SUmner
f0f3d6d4eb Statically link libicu on Linux so it doesn't require installing icu separately.
this doubles the binary size :(
2021-10-04 20:41:27 -07:00
Jarred SUmner
21d918921a memfd experiment did not yield perf gains on Linux
I suspect the reason why is because we were already using tmpfs. So it was already writing to an in-memory file. O_TMPFILE doesn't seem to do anything for us either here.
2021-10-04 20:01:05 -07:00
Jarred Sumner
55095edee6 Don't pass O_EXCL 2021-10-04 19:07:19 -07:00
Jarred Sumner
6a7deab74d O_TMPFILE 2021-10-04 19:00:18 -07:00
Jarred Sumner
7db27f11d0 memfd_create does not actually make it faster 2021-10-04 18:58:31 -07:00
Jarred Sumner
3ebb4feb98 Attempt to optimize bun bun on Linux by using memfd_create and copying the resulting file via sendfile() 2021-10-04 18:37:51 -07:00
Jarred Sumner
e8dab9bfcf Fix moving files across mount points 2021-10-04 15:35:08 -07:00
Jarred Sumner
dc3eee44a9 Bump 2021-10-04 04:54:23 -07:00
Jarred Sumner
9e8463af33 Bump 2021-10-04 04:31:43 -07:00
Jarred Sumner
dd2bdd09db Bump 2021-10-04 03:33:54 -07:00
Jarred Sumner
0eb3c1d393 Improve Bun's performance by 5%
By making E.Identifier not a pointer, we improve performance by 5%. Heap allocations are bad
2021-10-04 03:28:55 -07:00
Jarred SUmner
cb6a1b7225 Use covid19 example 2021-10-03 23:53:57 -07:00
Jarred SUmner
38c73788e1 Bump 2021-10-03 21:55:50 -07:00
Jarred Sumner
2c89122ce9 Update Makefile 2021-10-03 21:53:21 -07:00
Jarred Sumner
2eae013ebf Update Makefile 2021-10-03 21:50:27 -07:00
Jarred Sumner
1247a9c93d Update Makefile 2021-10-03 21:49:26 -07:00
Jarred Sumner
5c6dd19826 Update Makefile 2021-10-03 21:49:11 -07:00
Jarred Sumner
9d0ee5c5cd Update Makefile 2021-10-03 21:47:34 -07:00
Jarred Sumner
3affc2a2d8 Update Makefile 2021-10-03 21:46:13 -07:00
Jarred Sumner
02bdaa6d10 Fix tmpdir on linux 2021-10-03 21:43:10 -07:00
Jarred Sumner
aee263d050 Update linux build instructions 2021-10-03 21:21:54 -07:00
Jarred Sumner
7ac4abf8a0 Create separate profile binary and strip debug symbols 2021-10-03 20:40:04 -07:00
Jarred Sumner
139622e0b8 llvm-strip 2021-10-03 20:36:59 -07:00
Jarred Sumner
aaa4aaf53f Fix makefile issue 2021-10-03 20:33:47 -07:00
Jarred Sumner
73c27a9a25 Fix various macOS-specific compile errors and run zig fmt 2021-10-03 20:26:54 -07:00
Jarred SUmner
82bf89a946 1% perf improvements on Linux 2021-10-03 18:49:31 -07:00
Jarred SUmner
f4a4e793aa Add Three.js benchmark 2021-10-03 02:22:00 -07:00
Jarred SUmner
cdabcfd9d0 Linux works now. 2021-10-02 22:54:19 -07:00
Jarred Sumner
ac7a96b088 Add support for INotify-based filesystem watcher 2021-10-01 22:41:59 -07:00
Jarred Sumner
6932f3d543 Merge branch 'jarred/linux' of github.com:Jarred-Sumner/bun into jarred/linux 2021-10-01 15:08:14 -07:00
Jarred SUmner
222027991f Build stuff 2021-10-01 15:05:34 -07:00
Jarred Sumner
5bb5091fe0 Bump webkit 2021-10-01 15:02:17 -07:00
Jarred Sumner
c8127d0ae6 Split out the macOS specific parts 2021-10-01 02:06:35 -07:00
Jarred Sumner
8764fa6d4e Update README.md 2021-09-30 23:37:33 -07:00
Jarred Sumner
86b7b5b8d8 Update README.md 2021-09-30 23:37:03 -07:00
Jarred Sumner
127426f506 Update README.md 2021-09-30 23:34:20 -07:00
Jarred Sumner
09cc970b9e Update README.md 2021-09-30 23:33:28 -07:00
Jarred Sumner
03f7c5be1f Fix up readme 2021-09-30 23:29:19 -07:00
Jarred Sumner
4ecf513662 Bump version 2021-09-30 23:22:35 -07:00
Jarred Sumner
76b450386f Add a readme 2021-09-30 23:22:28 -07:00
Jarred Sumner
38a54898a3 Bump build-id 2021-09-30 22:38:03 -07:00
Jarred Sumner
147d1f3951 runtime.version 2021-09-30 22:37:57 -07:00
Jarred Sumner
d47419f471 Snapshots 2021-09-30 22:37:46 -07:00
Jarred Sumner
367f9c9674 Add test that void doesn't delete call expressions 2021-09-30 22:36:06 -07:00
Jarred Sumner
f9a906873e bun-macro-relay works now! 2021-09-30 22:35:34 -07:00
Jarred Sumner
4be8aaeab8 Pass MacroContext in more places 2021-09-30 22:35:20 -07:00
Jarred Sumner
5fdaad9a2f Pass macro_context when appropriate. This needs to be refactored more. 2021-09-30 22:34:54 -07:00
Jarred Sumner
5855fb7cc6 Make sure VM initializes with BUN_* defines 2021-09-30 22:34:36 -07:00
Jarred Sumner
f226f52200 Fix edgecase with cjs -> esm interop runtime code when module.exports was marked as not extensible 2021-09-30 22:34:17 -07:00
Jarred Sumner
db24a27e61 Fix potential infinite loop on calling macros 2021-09-30 22:33:36 -07:00
Jarred Sumner
f8297aee4d Fix jsxDEV transform bug that occurred when not including source and the component rendered an exception 2021-09-30 22:32:03 -07:00
Jarred Sumner
b267aace71 Fix dead-code elimination edgecase with call expressions 2021-09-30 22:30:32 -07:00
Jarred Sumner
b4bd8e4169 Fix edgecase with parsing .env 2021-09-30 22:29:33 -07:00
Jarred Sumner
fdda1078f8 Support remapping macro paths 2021-09-30 18:58:39 -07:00
Jarred Sumner
88e7e12a50 Fix all the compile errors 2021-09-30 14:20:45 -07:00
Jarred Sumner
4cdc8939ab Wire up macro-injected imports and move some structs above the gigantic parser type to reduce bun compile time a little 2021-09-30 13:49:46 -07:00
Jarred Sumner
ec256209a8 flatten fragments 2021-09-30 01:54:53 -07:00
Jarred Sumner
74db7809eb Most of the code & API changes necessary for supporting Relay (GraphQL) 2021-09-29 23:28:54 -07:00
Jarred Sumner
5dac4e6108 Cleanup 2021-09-27 21:25:12 -07:00
Jarred Sumner
e51155d8e6 Remove 2021-09-27 21:25:06 -07:00
Jarred Sumner
2bb7f71b9c Fix up examples 2021-09-27 21:21:51 -07:00
Jarred Sumner
2f8be4f13f () 2021-09-27 21:05:20 -07:00
Jarred Sumner
8e9d85f10f Add fetchCSV() example macro 2021-09-27 21:04:30 -07:00
Jarred Sumner
70bae801dc Bump 2021-09-27 21:03:09 -07:00
Jarred Sumner
37ffe4501c Ignore leading invalid unicode characters in response bodies in Response.text() 2021-09-27 21:03:00 -07:00
Jarred Sumner
13f6297312 Access object properties from macros 2021-09-27 21:01:34 -07:00
Jarred Sumner
f9dfa226a5 Fix bug in string eql check that was never used before 2021-09-27 20:53:57 -07:00
Jarred Sumner
0da19a25cf u16 isn't big enough 2021-09-27 16:28:04 -07:00
Jarred Sumner
3b92a867e2 Pass User-Agent in fetch() by default (but allow overriding) 2021-09-27 16:09:17 -07:00
Jarred Sumner
1ada4a2c67 Fix bug in URL parser 2021-09-27 16:08:57 -07:00
Jarred Sumner
97ad21dc68 Fix typo in error 2021-09-27 16:08:34 -07:00
Jarred Sumner
54dc9cfc8b upgrade 2021-09-27 01:45:53 -07:00
Jarred Sumner
1ed51e8866 Commit build 2021-09-27 01:35:37 -07:00
Jarred Sumner
9e0511995a Merge branch 'jarred/ast-again' 2021-09-27 01:34:12 -07:00
Jarred Sumner
62d51f7d2e Set macros enabled 2021-09-27 01:33:53 -07:00
Jarred Sumner
4f9558dd71 Bundling ignores macros 2021-09-27 01:33:23 -07:00
Jarred Sumner
86109dcfd0 Add a few macros examples 2021-09-27 01:33:15 -07:00
Jarred Sumner
adf22db8b6 bounds checking 2021-09-27 00:40:44 -07:00
Jarred Sumner
eb3473125c Allow nested arrays 2021-09-26 23:04:07 -07:00
Jarred Sumner
b3894994c0 Fix getting object properties 2021-09-26 21:21:51 -07:00
Jarred Sumner
e1306be4be Update Bun.readFileAsBytes and Bun.readFile to also accept an array of filepaths to join
For example:
```
Bun.readFileAsString([Bun.main, "../pages/hi.tsx"]);
```
2021-09-26 20:06:10 -07:00
Jarred Sumner
002d46d0c4 Add JSArrayIterator, don't call JSC::Options after JSC already loaded once (that causes a crash) 2021-09-26 20:04:26 -07:00
Jarred Sumner
018ba2c83b Most of macro implementation 2021-09-26 20:03:49 -07:00
Jarred Sumner
66ed7c1f30 Basic macro impl 2021-09-26 00:14:15 -07:00
Jarred Sumner
a113603f10 Merge pull request #29 from alexkuz/patch-1 2021-09-25 18:03:23 -07:00
Alexander Kuznetsov
6f6d62d915 Check requirements for the build 2021-09-26 03:56:02 +03:00
Jarred Sumner
ff8393ce32 WIP 2021-09-25 14:16:05 -07:00
Jarred Sumner
8b209aecf9 fix incorrect comment 2021-09-25 14:16:05 -07:00
Jarred Sumner
a515a2d039 Add .git 2021-09-25 14:14:33 -07:00
Jarred Sumner
d0fec462c9 Snapshots & package.json 2021-09-25 02:12:01 -07:00
Jarred Sumner
20e2040e7e Add integration test that checks styled-components renders successfully and no incorrect unicode characters are present in the style tag 2021-09-25 02:06:06 -07:00
Jarred Sumner
538f73b2fa Bump version 2021-09-25 02:05:15 -07:00
Jarred Sumner
a0fb04d6e5 Fix bug with resolving "browser" field in package.json
It was resolving from the parent directory of the result instead of the browser scope.
2021-09-25 02:05:01 -07:00
Jarred Sumner
44497ef384 Fix lexing bug with the \f form feed character (used in Emotion & Styled Components) 2021-09-25 02:03:59 -07:00
Jarred Sumner
5fb38b92d9 Fix crashing edgecase when both JSX automatic and JSX classic imports are necessary and unbundled 2021-09-25 02:03:27 -07:00
Jarred Sumner
4737588aac Bump version 2021-09-25 00:35:39 -07:00
Jarred Sumner
a5d3ce4e96 Add integration test for <JSX key="foo" {...spread} onClick={() => {}} /> 2021-09-25 00:34:30 -07:00
Jarred Sumner
66b29654c0 Fix visiting bug when using JSX with a spread prop and a key and one of the props is an anonymous function
More specifically, Bun shouldn't be visiting the same properties more than once. That was the cause.
2021-09-25 00:33:45 -07:00
Jarred Sumner
940570af59 skeleton code 2021-09-24 16:41:45 -07:00
Jarred Sumner
bdfb5a91b1 macro 2021-09-24 15:33:02 -07:00
Jarred Sumner
29b986684d 🍧 2021-09-24 15:28:30 -07:00
Jarred Sumner
e48a0877ef @setCold 2021-09-24 15:26:55 -07:00
Jarred Sumner
22837d69b7 Remove cache_files since it's not used and causes slower Bun compilation times 2021-09-24 15:23:55 -07:00
Jarred Sumner
af306b523b Update README.md 2021-09-24 14:49:17 -07:00
Jarred Sumner
ba20fd7566 Update README.md 2021-09-24 14:28:12 -07:00
Jarred Sumner
6d1330d601 Update README.md 2021-09-24 14:26:54 -07:00
Jarred Sumner
f3be0c79c2 Update README.md 2021-09-24 14:26:05 -07:00
Jarred Sumner
10c01af692 Update README.md 2021-09-23 23:28:45 -07:00
Jarred Sumner
a68a1983cf Update README.md 2021-09-23 23:28:25 -07:00
Jarred Sumner
90a647fb72 Update README.md 2021-09-23 23:22:41 -07:00
Jarred Sumner
3cbf209d5b clarify 2021-09-23 23:18:38 -07:00
Jarred Sumner
bee45c4fdc add the other tests 2021-09-23 22:54:38 -07:00
Jarred Sumner
61202cb464 Update README.md 2021-09-23 22:46:43 -07:00
Jarred Sumner
0091944161 Elaborate on bun bun a little 2021-09-23 22:43:20 -07:00
Jarred Sumner
78cd857bf6 Add link to webpack doc 2021-09-23 22:09:41 -07:00
Jarred Sumner
4fe1b4df1c Bump version 2021-09-23 22:02:13 -07:00
Jarred Sumner
2a1235c9db 🏃 2021-09-23 22:01:43 -07:00
Jarred Sumner
4bb41b95a8 📷 2021-09-23 22:01:34 -07:00
Jarred Sumner
f78f4854a4 Handle more edgecases in our CJS2ESM conversion code 2021-09-23 21:45:15 -07:00
Jarred Sumner
ff01dfa03d When bundling JSON, only use JSON.parse when the input is ASCII.
We don't want to add an extra pass over the input to convert it to UTF16. And JS engines storing strings as UTF-16 is more expensive anyway, so the runtime win here probably isn't as big (though open to evidence to the contrary!)
2021-09-23 21:43:37 -07:00
Jarred Sumner
638b204d1e Add __exportValue and __exportDefault to runtime 2021-09-23 19:20:33 -07:00
Jarred Sumner
58e88c4aed When bundling, parse the JSON to verify correctness, but print it as a string for better runtime performance 2021-09-23 19:20:07 -07:00
Jarred Sumner
8433919342 Safer export default transform for bundled code 2021-09-23 19:19:32 -07:00
Jarred Sumner
8150b9aeba Fix crash when loading JS fails really quickly 2021-09-23 17:40:25 -07:00
Jarred Sumner
01601fc8a7 Globally define require() so that UMD modules which check for the existence of require() to determine if it's CommonJS use the CommonJS code path instead of the globalThis code path 2021-09-23 17:36:49 -07:00
Jarred Sumner
7b24042d5f Embed regeneratorRuntime so that things which expect it to be a global still work 2021-09-23 17:36:04 -07:00
Jarred Sumner
2177dda242 Fix bug when multiple-levels of nested exports when bundled have a boolean .default value 2021-09-23 17:34:54 -07:00
Jarred Sumner
0585c86390 Support alwaysBundle for workspace packages 2021-09-23 17:33:20 -07:00
Jarred Sumner
528caab47c Add a pointer to the parent package_json for a directory. This reduces pointer chasing 2021-09-23 17:33:01 -07:00
Jarred Sumner
b150df34e0 Fix another simplification bug 2021-09-23 17:32:39 -07:00
Jarred Sumner
da80c3b309 Fix a simplification bug 2021-09-23 17:32:29 -07:00
Jarred Sumner
e8804bd80f Use the package_json hash for matching bundled modules instead of searching strings (should improve perf a little) 2021-09-23 17:31:59 -07:00
Jarred Sumner
2300886008 Symlinks work 2021-09-23 13:29:51 -07:00
Jarred Sumner
57ed3c89a2 Add "bun": { "alwaysBundle": ["packageName"] }, to package.json
This is for monorepos that symlink directories into node_modules. For example, if you have a design system in your monorepo, you probably want to always bundle that.
2021-09-23 00:17:06 -07:00
Jarred Sumner
1a284a1c94 Extremely minor perf improvements 2021-09-22 18:12:18 -07:00
Jarred Sumner
f12dd51c00 Update query_string_map.zig 2021-09-22 16:19:25 -07:00
Jarred Sumner
e00c1e99d6 Allow URLs containing absolute filepaths in imports if they match specific file extensions
This is to support ../../ imports

Allowlisting to specific file extensions prevents common webserver security vulnerabilities like reading /etc/passwd
2021-09-22 16:19:16 -07:00
Jarred Sumner
39323b46ba Fix edgecase with whether to wrap arrow expressions in parentheses when printing 2021-09-22 16:13:44 -07:00
Jarred Sumner
9dff80aeee Fix edgecase with bare imports inside .bun 2021-09-22 16:13:14 -07:00
Jarred Sumner
9f7d05bab4 Print how many lines of code was parsed in bun bun 2021-09-22 04:08:40 -07:00
Jarred Sumner
53c0a4b568 Add disabled status to ESM resolution 2021-09-22 02:17:13 -07:00
Jarred Sumner
8f460a9be3 Fix parsing bug with arrays that have default values 2021-09-22 02:16:31 -07:00
Jarred Sumner
204b07f46b package json exports seems to work now!!! 2021-09-22 01:03:06 -07:00
Jarred Sumner
a48a02bade Switch to a single directory for storing snapshots and explicitly note whats a debug snapshot and a non-debug snapshot 2021-09-22 01:02:32 -07:00
Jarred Sumner
2326a1e105 Fix the compiler errors 2021-09-21 23:28:05 -07:00
Jarred Sumner
c4dc6d9bff Resolve "exports" field in package.json (doesn't work yet) 2021-09-21 22:52:40 -07:00
Jarred Sumner
6213a73e6f Add "exports" to PackageJSON 2021-09-21 21:53:38 -07:00
Jarred Sumner
9c109b744f Most of the ESM resolution algorithm (still untested) 2021-09-21 21:49:32 -07:00
Jarred Sumner
42c1d54b3f endsWithAny -> endsWithAnyComptime 2021-09-21 18:07:23 -07:00
Jarred Sumner
5e634cd612 Parse "exports" field from package.json (WIP) 2021-09-21 18:05:42 -07:00
Jarred Sumner
79c7fe0f7a [Bun.js] Add Bun.readFileBytes() to get a Uint8Array of the file's contents without copying. 2021-09-21 15:39:52 -07:00
Jarred Sumner
8e86d2cf1d Add comment explaining failed package.json parsing optimization 2021-09-21 14:40:19 -07:00
Jarred Sumner
4e12a4c013 [Bun.js] Add support for console.time, console.timeEnd 2021-09-21 00:58:55 -07:00
Jarred Sumner
e869cdca9f Slightly improve .env loader string inference 2021-09-20 22:37:39 -07:00
Jarred Sumner
ab565f1a3c Fix parsing/printing unicode identifiers, switch to UTF-8 for prefilled strings, remove eagerly loading identifier_name 2021-09-20 22:37:22 -07:00
Jarred Sumner
90cd3bf4cb Fix how error lines with strings are highlighted 2021-09-20 18:04:45 -07:00
Jarred Sumner
9752ee8819 Always log errors when generating node_modules.server.bun 2021-09-20 17:40:09 -07:00
Jarred Sumner
9f1e0660dd Fix handling when file metadata store stored exceeds statically allocated count (at time of writing, 16k) 2021-09-20 17:39:39 -07:00
Jarred Sumner
7c05bb7d1d Merge pull request #27 from DAlperin/main 2021-09-17 20:33:48 -07:00
Dov Alperin
bb0faacf06 All deps now build on linux
Move CC and CXX into variables
Fix some capitalization
+A few other portability improvements
2021-09-17 23:21:06 -04:00
Jarred Sumner
9ae35ec581 Slightly improve JSX decoding perf 2021-09-17 18:37:26 -07:00
Jarred Sumner
b1ca1eb228 Package.json 2021-09-17 17:42:01 -07:00
Jarred Sumner
832502555c Bump 2021-09-17 17:40:54 -07:00
Jarred Sumner
1176a07c93 Fix whitespace & emoji bug when parsing JSX 2021-09-17 17:40:30 -07:00
Jarred Sumner
3770102843 Snapshots 2021-09-17 16:22:53 -07:00
Jarred Sumner
cf7c80d42d package.json 2021-09-17 16:22:43 -07:00
Jarred Sumner
84632571c7 Add test for "shuffle" function for lodash 2021-09-17 16:10:43 -07:00
Jarred Sumner
af1061e47a Update js_printer.zig 2021-09-17 16:09:59 -07:00
Jarred Sumner
e1ce0e8467 Fix lexer bug with UTF-16 strings 2021-09-17 16:09:26 -07:00
Jarred Sumner
468c475359 Add test for tsx/ts fallback imports 2021-09-17 15:15:43 -07:00
Jarred Sumner
8902a19bb4 Update package.json 2021-09-17 15:10:02 -07:00
Jarred Sumner
f4e72be58f Update launch.json 2021-09-17 15:09:59 -07:00
Jarred Sumner
c20b5414c4 Fix test makefile 2021-09-17 15:01:28 -07:00
Jarred Sumner
1a0438b3b1 Update cjs-transform-shouldnt-have-static-imports-in-cjs-function.js 2021-09-17 14:54:42 -07:00
Jarred Sumner
da2f85ba4b Exclude snapshots from search 2021-09-17 14:50:21 -07:00
Jarred Sumner
bc65e40313 Fix multiple imports to CJS modules when referencing via module_id hash 2021-09-17 14:47:14 -07:00
Jarred Sumner
a188c7d791 Bump build ID 2021-09-17 14:28:47 -07:00
Jarred Sumner
f2cccdd1fb Merge branch 'main' of github.com:Jarred-Sumner/bun 2021-09-17 14:27:55 -07:00
Jarred Sumner
6621de709e Commit previosu bump 2021-09-17 14:25:28 -07:00
Jarred Sumner
98e9b93b7e global -> globalThis 2021-09-17 14:24:42 -07:00
Jarred Sumner
3aef65597b Merge pull request #26 from DAlperin/main
Get bun ready for linux builds
2021-09-17 05:47:33 -07:00
Dov Alperin
c98e007ff7 Get bun ready for linux builds
Adds: conditional builds in makefile
Fixes: incorrect imports of 'JavaScriptCore.zig' (note the caps 's')
replaces with correct import of 'JavascriptCore.zig'
2021-09-17 08:43:15 -04:00
Jarred Sumner
3350e63004 Add puppeteer to package.json 2021-09-17 03:14:56 -07:00
Jarred Sumner
d71b37e292 Little more clarify readme 2021-09-17 03:14:40 -07:00
Jarred Sumner
1c7485e58c Begin to add integration tests 2021-09-17 03:14:23 -07:00
Jarred Sumner
872428de89 Fix bugs with ESM -> CJS when not bundled 2021-09-17 03:14:05 -07:00
Jarred Sumner
93441babd8 Do not attempt to HMR export {value} from, just assume it will be HMR'd (or not) 2021-09-16 22:37:11 -07:00
Jarred Sumner
1328285bbc Update options.zig 2021-09-16 20:35:08 -07:00
Jarred Sumner
9912a4ce98 Fix export * as from 2021-09-16 20:34:48 -07:00
Jarred Sumner
d5186ee663 Add flag to dev server to disable HMR 2021-09-16 20:34:22 -07:00
Jarred Sumner
9e2910365a Help output should print command names 2021-09-16 19:08:02 -07:00
Jarred Sumner
3be2571a31 Fix symbol name for cjs2esm 2021-09-16 18:46:27 -07:00
Jarred Sumner
6352e95d0f When port is in use, auto-increment port number up to 10 times and then bail if all 10 are in use 2021-09-16 18:27:54 -07:00
Jarred Sumner
b6a72f7d72 Always bold ^ 2021-09-16 17:49:17 -07:00
Jarred Sumner
b923134023 Delete some dead code 2021-09-16 17:38:05 -07:00
Jarred Sumner
6e82fa0dab Print absolute paths in log errors so that ctrl+click to open file in editor works (depending on terminal) 2021-09-16 17:37:52 -07:00
Jarred Sumner
9511bf94d5 Colorize build/resolve errors and add a ^ 2021-09-16 17:37:22 -07:00
Jarred Sumner
03983ac24e Commit build id 2021-09-16 03:31:29 -07:00
Jarred Sumner
347dbc6237 Automatically rewrite TS import paths from .jsx? -> .tsx? when .jsx? is not found
This was already partially implemented but it was returning filenames instead of absolute paths. This matches the behavior from https://github.com/microsoft/TypeScript/issues/4595.
2021-09-16 03:24:27 -07:00
Jarred Sumner
b2a6f3f81c write the version 2021-09-15 23:42:47 -07:00
Jarred Sumner
5a89f30841 Switch to 0.0.x instead of 0.0.0-x to fix the npm install issue 2021-09-15 23:34:17 -07:00
Jarred Sumner
244585b82a Bump versions 2021-09-15 21:42:24 -07:00
Jarred Sumner
bc727e8d79 Bump 2021-09-15 21:30:32 -07:00
Jarred Sumner
472589aa14 Fix require bug in runtime.js 2021-09-15 21:30:12 -07:00
Jarred Sumner
ba9825eca9 Fix CJS symbol names 2021-09-15 21:29:49 -07:00
Jarred Sumner
f4d1a3c33d Remove most usages of anytype in js_ast.zig 2021-09-15 21:29:20 -07:00
Jarred Sumner
be05f65339 Fix crash in bun bun 2021-09-15 21:28:06 -07:00
Jarred Sumner
dcabe86ea8 woops 2021-09-15 19:00:41 -07:00
Jarred Sumner
2a98c323c1 Bump 2021-09-15 18:53:06 -07:00
Jarred Sumner
be5ed44580 Add aarch64 2021-09-15 18:40:00 -07:00
Jarred Sumner
93010b71b4 delete dead code 2021-09-15 18:11:56 -07:00
Jarred Sumner
62d9a18ec6 zig fmt 2021-09-15 18:11:51 -07:00
Jarred Sumner
b0bb65f494 Big Heap: 2021-09-15 18:07:08 -07:00
Jarred Sumner
09ab634d32 Fix Bun on M1. 2021-09-15 17:06:49 -07:00
Jarred Sumner
bba102c076 Warn when JIT is disabled 2021-09-15 17:04:00 -07:00
Jarred Sumner
9719ae096d Fix build-generated typo 2021-09-14 23:07:55 -07:00
Jarred Sumner
0854188f3c fix 2021-09-14 23:02:48 -07:00
Jarred Sumner
0cfcb96e5c typo 2 2021-09-14 23:01:47 -07:00
Jarred Sumner
39bbb7b9cd typo 2021-09-14 23:01:34 -07:00
Jarred Sumner
e3d828648e fix it better 2021-09-14 22:58:14 -07:00
Jarred Sumner
ed8f381b5c fix debug bin path 2021-09-14 22:57:19 -07:00
Jarred Sumner
516369d748 commit webkit update 2021-09-14 20:34:46 -07:00
Jarred Sumner
dff9fd8ae1 Tweak readme 2021-09-14 18:13:05 -07:00
Jarred Sumner
3f3dc56da5 Tweak readme 2021-09-14 18:03:24 -07:00
Jarred Sumner
5dbbad5cc4 Support installing bun from npm 2021-09-14 16:59:21 -07:00
Jarred Sumner
24522f7d74 Include build id in welcome note 2021-09-14 13:23:51 -07:00
Jarred Sumner
4173b03f54 Include a build id 2021-09-14 02:21:40 -07:00
Jarred Sumner
bdd5502aef SPAs now work by default when there's a public/index.html file 2021-09-14 01:28:04 -07:00
Jarred Sumner
2f301e39d7 Handle edgecase during SyntaxError that can lead to an out of bounds index access when printing source code 2021-09-14 01:24:37 -07:00
Jarred Sumner
c75ae828bc FIx missing page assets with next.js 2021-09-13 22:30:16 -07:00
Jarred Sumner
b0598f64ea Fix crashes when accessing request metadata 2021-09-13 22:29:44 -07:00
Jarred Sumner
8721ba7474 v0.0.0-21 2021-09-13 22:28:16 -07:00
Jarred Sumner
d7a5b60405 v0.0.0-20 2021-09-13 21:47:44 -07:00
Jarred Sumner
4f0d4cee0b Feature flag auto_import_buffer since it's not fully implemented yet 2021-09-13 20:56:22 -07:00
Jarred Sumner
a0b6892c09 Good enough for now solution to symbol collision 2021-09-13 02:53:18 -07:00
Jarred Sumner
359df89fe3 Fix "browser" map resolution, _almost_ fix symbol collisions, cache absolute paths for file entries 2021-09-12 23:40:12 -07:00
Jarred Sumner
dca47a565e ok 2021-09-12 01:53:32 -07:00
Jarred Sumner
19922287aa Fix panic handler to not double panic 2021-09-12 00:40:27 -07:00
Jarred Sumner
5944c91de4 Support importing Node.js fallback modules as ESM 2021-09-12 00:40:17 -07:00
Jarred Sumner
350569655b Support bundling dynamically imported modules. 2021-09-12 00:39:57 -07:00
Jarred Sumner
092f9ac766 Fix CommonJS interop issue when, while linking, we find out the import is possibly CommonJS 2021-09-12 00:39:01 -07:00
Jarred Sumner
dfb65ef1ca Reduce number of allocations for serializing error messages 2021-09-12 00:37:59 -07:00
Jarred Sumner
57ca04444b Fix symbol collisions for JSX & React Refresh. Choose a JSX identifier based on the user's JSX import source 2021-09-12 00:37:13 -07:00
Jarred Sumner
125d88bd65 bun:error.js into separate module, ensure we don't include fast refresh in Bun.js, log build errors to browser console, don't warn for node_modules, 2021-09-11 01:48:23 -07:00
Jarred Sumner
6f2554b13a Tweaks 2021-09-10 13:41:24 -07:00
Jarred Sumner
b66ef23167 yay 2021-09-10 03:32:21 -07:00
Jarred Sumner
812f641ee3 fix 2021-09-10 02:39:50 -07:00
Jarred Sumner
4bd9cccbc9 filepath 2021-09-10 02:34:12 -07:00
Jarred Sumner
2ebe9ad101 v0.0.0-19 2021-09-09 23:34:08 -07:00
Jarred Sumner
fc907e2f81 current 2021-09-09 23:33:34 -07:00
Jarred Sumner
8a02ad48a5 fetc h!!! 2021-09-09 05:40:07 -07:00
Jarred Sumner
c30ec608b1 upgrade 2021-09-08 16:57:10 -07:00
Jarred Sumner
d18e73aa57 Fixes for AARCH64: 2021-09-08 01:03:08 -07:00
Jarred Sumner
292668ed43 up 2021-09-07 22:09:47 -07:00
Jarred Sumner
2a6edf00cd lotta changes 2021-09-07 22:08:18 -07:00
Jarred Sumner
cbd2c56a1f Initial
Former-commit-id: 780ec8b1a7ce2f06ccb1dc01a4df84bf866803e8
2021-09-07 20:39:37 -07:00
Jarred Sumner
83c54db836 more words
Former-commit-id: 7ad294cded991218c79f9036ba9a632a87d05634 [formerly 78058ac327ae266296588613d97391aa470f49a6]
Former-commit-id: 7eb9207a6e9c3667439228b760945f8f2f6049d9
2021-09-07 14:50:52 -07:00
Jarred Sumner
abf5f873b6 more readme
Former-commit-id: f38ce524a75c9b0781d3fcf9ae4f5f8da888395f
2021-09-07 14:41:31 -07:00
Jarred Sumner
1d1a70c21f WIP error css
Former-commit-id: 36f03bf491cf274f68361e334a706538464ee271
2021-09-07 03:21:58 -07:00
Jarred Sumner
d59e7b27b0 expose top level dir
Former-commit-id: 00c222c35a4460b21e095acc35a470fbb4778b19
2021-09-06 03:37:37 -07:00
Jarred Sumner
0108695438 Always store the list of stylesheets
Former-commit-id: 867ebf04348439c48037e4944fef6d48a33555bd
2021-09-06 03:37:17 -07:00
Jarred Sumner
34b55c3350 Fix crashy bug
Former-commit-id: 76162477e0c315599b375dd2aba0acdc58864b59
2021-09-06 03:36:59 -07:00
Jarred Sumner
2fc89a69e3 Move
Former-commit-id: b795168d774fa0b3dcde7955e30baa0eefbc88ab
2021-09-05 21:44:43 -07:00
Jarred Sumner
cb70d08573 current
Former-commit-id: 8517ba72e79b75bf016c3fa66deb85fab9ff6554
2021-09-05 21:43:25 -07:00
Jarred Sumner
cd69063660 Update README.md
Former-commit-id: 74973a4535244c65269247334b59ae6d7d3598ea
2021-09-05 19:41:08 -07:00
Jarred Sumner
0822e67594 such entitle
Former-commit-id: de26ae30116e3c13c48a710201a7da0817ffd9e5
2021-09-05 19:40:59 -07:00
Jarred Sumner
7e79d9dae6 Update WebKit
Former-commit-id: db455d9f78cfe3526f79a94ef28d9680f8a21a69
2021-09-05 17:21:44 -07:00
Jarred Sumner
bb84a8cc6c prefix
Former-commit-id: 92ed909e1eb98542d61b7f04c1ab02c22ab20b37
2021-09-05 16:51:12 -07:00
Jarred Sumner
2c429f7732 guess
Former-commit-id: 6e95bd8a1457d3c514adb0af6ae0c5feb1564a80
2021-09-05 16:48:26 -07:00
Jarred Sumner
4f966f30a5 Fix sizegen
Former-commit-id: f8e8a357c00ceb2d71e216af21daf56f7ba27a1b
2021-09-05 16:21:53 -07:00
Jarred Sumner
ac123f2371 create-react-app
Former-commit-id: 33647ef65cbac1c89c16a8b81dfa7de0fad5af3e
2021-09-05 15:34:35 -07:00
Jarred Sumner
48dadc17f6 Makefile
Former-commit-id: fdda2024afeaab244a19ab31380a1c4739c67f4c
2021-09-05 15:21:06 -07:00
Jarred Sumner
fb4feea8c3 aarch64 build.zig
Former-commit-id: 701ec4668e8f8276c207d92487633857d2db5ead
2021-09-05 15:18:13 -07:00
Jarred Sumner
4749669e74 Makefile
Former-commit-id: 7815afe6a5a250b14dff1a769fd4c30066fcb466
2021-09-05 14:33:29 -07:00
Jarred Sumner
6f2749d13d Update WebKit
Former-commit-id: 2d155ba16395ac01c08daddcbe1e861eaddacda7
2021-09-05 14:27:48 -07:00
Jarred Sumner
e43d3e995f package.json
Former-commit-id: 2299f44cc9092dad2ef48ea54af2555c192a723e
2021-09-05 14:27:00 -07:00
Jarred Sumner
c20df72d73 more mutexes
Former-commit-id: 52966012b4b74d24ab28a0c75740aef35fb75327
2021-09-05 02:05:45 -07:00
Jarred Sumner
b8941666b4 v0.0.0-18
Former-commit-id: 597600521199046bc81d311f9bd29983331d9dac
2021-09-04 18:34:03 -07:00
Jarred Sumner
4f7ff6db2c Fixed memory leaks, but SSR is slower. Should move cleanup & restart steps to a real idle timeout
Former-commit-id: 9499ee3109cb336deb9380f0190631a30c9da51c
2021-09-04 04:50:47 -07:00
Jarred Sumner
0045fc36d6 Update README.md
Former-commit-id: a46d0259e6024b2321e25c055b11fece207936f7
2021-09-03 13:40:47 -07:00
Jarred Sumner
44ae01dded Update README.md
Former-commit-id: 4511f00ba592e99bafdc74aaea08b247183c135d
2021-09-03 13:23:06 -07:00
Jarred Sumner
e48b5945c3 Update README.md
Former-commit-id: d36fba6fe02efdea602e70a2552eeb3e20cf58ae
2021-09-03 13:21:12 -07:00
Jarred Sumner
194b60191d Update README.md
Former-commit-id: 3e5e26fccb7a2127f4bf396494e99d33f965840d
2021-09-03 13:20:27 -07:00
Jarred Sumner
172aede346 release make
Former-commit-id: 0828b39f9961e68d2705610cbd866ad33aa2d656
2021-09-03 13:19:46 -07:00
Jarred Sumner
b85cfa52d0 loggers gonna log
Former-commit-id: cbf0b6750fbee21df6a78231e7050307c9af1d96
2021-09-03 13:19:36 -07:00
Jarred Sumner
a90760b597 Fix logging in bun bun + bump
Former-commit-id: 19275a07342879d9b02b9d9527b762c8bfadb9e6
2021-09-03 13:01:36 -07:00
Jarred Sumner
3fc0c899c9 endsWith("") should return true
Former-commit-id: fdbb66abc4e539ef960a72588495cd9964eff68b
2021-09-02 19:26:07 -07:00
Jarred Sumner
2e58176ac7 Ensure we log the file path when reading a file fails
Former-commit-id: 90f53eafb983bccd662c0329f031cef405bc80b0
2021-09-02 19:25:54 -07:00
Jarred Sumner
54a7c4290a More defensive file handle reuse
Former-commit-id: 5bb38e0bc75a600d9c1b744990d9e4a1b66edf42
2021-09-02 19:25:32 -07:00
Jarred Sumner
4debcdcbbb Fix tsconfig paths
Former-commit-id: 1ea6a0d624b0fc42acda9a81f214d06336b9271e
2021-09-02 19:24:51 -07:00
Jarred Sumner
f23d7c5259 Fix bug with spread properties in function arguments
Former-commit-id: 661fa35a8a0fbd9277682f6bd31cdf85c29481af
2021-09-02 19:24:35 -07:00
Jarred Sumner
d009e02c1d latest
Former-commit-id: 1086d4f894611c1171f57d9eaf82f9170e9de2d1
2021-09-02 15:54:07 -07:00
Jarred Sumner
1b894ad9f6 v0.0.0-17
Former-commit-id: 5b7e7714457dccd07091504e8b7244ba7600cd71
2021-09-02 11:58:41 -07:00
Jarred Sumner
336aa0d9a5 Commit latest bun-frmaework-next changes
Former-commit-id: ac2100b990eca4288201b070d0ba972484e57556
2021-09-02 11:54:38 -07:00
Jarred Sumner
c015c0c0cd Add warning when @tailwind, improve not found error for .css files
Former-commit-id: 0b776fb7f19dde86ea53968412c6eeaf9bae556f
2021-09-02 11:53:28 -07:00
Jarred Sumner
2fa09f7c09 Fix UMD, fix PNPM, importing require'd modules in app code
Former-commit-id: 3d831ad95904d2123964f2ebccff48f1e9f954e9
2021-09-02 11:51:52 -07:00
Jarred Sumner
47c660f2e1 v0.0.0-16
Former-commit-id: 7c92af994d5de52ef758ac1747c8e3d65eb39658
2021-09-02 01:04:03 -07:00
Jarred Sumner
4b7917ba8f latest
Former-commit-id: 20b96180ffc41610dfb21a041d1258f2ff8d4196
2021-09-01 14:00:46 -07:00
Jarred Sumner
e2b9f23231 Add display name field to frameworks, improve logging, add counters, add
Former-commit-id: b2cf011b6c6405a786fe22367e1cd4e6c2c4c90f
2021-08-31 23:07:03 -07:00
Jarred Sumner
78e1144ca5 Fix JSX fragments bug, fix unnamed export default bug
Former-commit-id: a48965cb80b713f72a859cd16c2a1b670c75d731
2021-08-31 21:38:05 -07:00
Jarred Sumner
212182f745 v0.0.0-15
Former-commit-id: 0741d36654eb5f94527cba22897d9849458e40a1
2021-08-31 19:43:19 -07:00
Jarred Sumner
00c5e07b56 v0.0.0-14
Former-commit-id: 0fa9174e701e4afbfba6ec18edda25578442a7c2
2021-08-31 15:05:18 -07:00
Jarred Sumner
6a5f34a6bc Fallback, fragments, printer compat, better errors
Former-commit-id: 486e8c9d460eeebea024e96dbabcb7f2bfaffafb
2021-08-31 15:03:40 -07:00
Jarred Sumner
bd9f137b1b latest
Former-commit-id: 096ec1222ad723d006b0151f10cb0c1b95e2bfd3
2021-08-29 21:48:14 -07:00
Jarred Sumner
34792c15f1 Single-threaded mode
Former-commit-id: 8f49faa68bf1357bdf5f0574036fb17216c4edcd
2021-08-29 21:46:15 -07:00
Jarred Sumner
69b101adcf Blob
Former-commit-id: 2174c6b769676c50686bb23a5ecca26a1d6eb1bc
2021-08-29 21:45:53 -07:00
Jarred Sumner
bd0f74a6fd v0.0.0-13
Former-commit-id: ccae6da4ab28ea9497134f1fac3e1d8e4e28df5c
2021-08-28 21:10:21 -07:00
Jarred Sumner
61ff6b8e49 v0.0.0-12
Former-commit-id: 3264fe15270286b26b700eb2a2b7f5edc91628d9
2021-08-28 21:04:58 -07:00
Jarred Sumner
65ea600b55 Fix unused imports
Former-commit-id: 7cbafbc9bddb77f8a1e65b084ff5942ed7ef1133
2021-08-27 18:20:02 -07:00
Jarred Sumner
c8f2def7c4 Fix missing RefreshRuntime import
Former-commit-id: 3b27a2cb502325f8c9ef0ae95f6bfaf5d4c9accd
2021-08-27 18:19:22 -07:00
Jarred Sumner
eba7b8b51e Always import runtime before JSX
Former-commit-id: efe0fb5edf07efa7f04ec379c2d319875b53ed87
2021-08-27 18:19:01 -07:00
Jarred Sumner
f53c4a0716 statusTExt
Former-commit-id: 52de5c6b9a3e8b030dcc2baf3fb372a50a7da99f
2021-08-27 18:17:05 -07:00
Jarred Sumner
4e3dd3aadc Skip unused
Former-commit-id: 82de54e123f629bf3ca17df6d10151b32efb2409
2021-08-27 18:16:57 -07:00
Jarred Sumner
476bcfdae3 const
Former-commit-id: 4366e33712174036de02e0446c09abeeb89aec83
2021-08-27 18:15:37 -07:00
Jarred Sumner
0510d63ee5 inline some things
Former-commit-id: aa13654739c00b669f0b0d864abff11a8386c2b5
2021-08-27 18:15:29 -07:00
Jarred Sumner
9a2ce8e1fa jsx comment fixture
Former-commit-id: e3d9bb34c8deff27b72a45f182522a0057eeb42d
2021-08-27 02:33:31 -07:00
Jarred Sumner
da540bc449 only do special default name handling when there is no default name alias
Former-commit-id: 1544ff0d1fdecf4ca9c379925f56fce98acbb656
2021-08-27 02:33:10 -07:00
Jarred Sumner
33f344288f Fix JSX comment parsing bug
Former-commit-id: ecaf29b47ec7b23a13615799a4e8ced9f42dcafe
2021-08-27 02:24:12 -07:00
Jarred Sumner
a8da18cbc4 Latest
Former-commit-id: a52b8b9f1052b3e3136c249aac0a7d93334a3eb7
2021-08-26 23:25:02 -07:00
Jarred Sumner
ec334111c9 better errors
Former-commit-id: a16d16ac2d649b3678d3baaa7a4641c7a56f5d6d
2021-08-26 22:40:22 -07:00
Jarred Sumner
92229ac0f6 Fix unbundled imports
Former-commit-id: f221da115c1afcd136648c9683d8e9907005a128
2021-08-26 21:43:42 -07:00
Jarred Sumner
3a34f2e952 Shouldn't have to type --use every time you bun bun
Former-commit-id: 5c9dc3f46c2382dd72b8cf8b54cbc58355301381
2021-08-26 21:43:14 -07:00
Jarred Sumner
3ae0accbe3 Fix file loader, automatically support CSS imports when a framework isn't set
Former-commit-id: 94750e5987ea8f6e4c946bfc06715e09a48c0eec
2021-08-26 19:56:25 -07:00
Jarred Sumner
db740a4eb4 Bun.readFile() api
Former-commit-id: 4fd408537571b7b960d1f451ef774a067c125fce
2021-08-26 15:10:07 -07:00
Jarred Sumner
a6bf54668a Bug fixes
Former-commit-id: 853b372665a3762b1eeeb2202e279895bce6f544
2021-08-26 15:09:53 -07:00
Jarred Sumner
029ba1ea44 Fix scoped packages with bun bun
Former-commit-id: c29ff9ff602aeed4f9b19e4f003a20effcf70c0a
2021-08-25 19:08:11 -07:00
Jarred Sumner
4541606469 latest
Former-commit-id: f5600d123d3710e7ea80ff2b7c66d13382462420
2021-08-25 17:56:06 -07:00
Jarred Sumner
039bf6ecdb mimalloc as git submodule
Former-commit-id: 946e614bf0a61d52767869942005fa8473d3877c
2021-08-24 00:49:39 -07:00
Jarred Sumner
04467b82d3 Disable verbose fs
Former-commit-id: dc7b2c059f3db6ca4f0e91d659b7a7269ed60263
2021-08-23 02:41:36 -07:00
Jarred Sumner
a3cfd26125 emoji
Former-commit-id: 812c1222bd62826a9bd829219970332d4b22bcd7
2021-08-23 02:31:06 -07:00
Jarred Sumner
945cd08931 Fix bug with copyLowercase and add a test
Former-commit-id: 87946b9fecd8b3e75a5995f38311053ae54b0424
2021-08-23 02:30:52 -07:00
Jarred Sumner
afb6684782 Fix resolve bug with mixed-case node_modules
Former-commit-id: 5bdae0ee491e28b49ceed6136f04e0c1feddc808
2021-08-23 02:30:30 -07:00
Jarred Sumner
8c67007926 Use mimalloc for a 10% boost
Former-commit-id: 044e11d720bc6742dc53b30b4e88e8be7e76c419
2021-08-23 02:29:07 -07:00
Jarred Sumner
e012efa124 Fix watcher when you move files/dirs around. It'll bust the cache and recreate it (and leak memory)
Former-commit-id: 8faf6127547411c1fdcee9e4e7440825f21ecd99
2021-08-21 22:53:25 -07:00
Jarred Sumner
468c22de0e feature_falgs
Former-commit-id: b6a313b37b2c92047eddb98dc2b05c2cda870a3b
2021-08-21 20:04:55 -07:00
Jarred Sumner
fe71f70775 ex
Former-commit-id: 92f6068939eaf4636a4a2bf4342a6eb1925ed5ed
2021-08-21 20:04:40 -07:00
Jarred Sumner
d90049be28 TinyString optimization
Former-commit-id: e23202f6228d292c4fac08c7667b5f2a0e5f1c32
2021-08-21 19:45:28 -07:00
Jarred Sumner
2d67691038 Readme
Former-commit-id: a6574eca3584deb7bad5e7681ddfa1c0058c652c
2021-08-21 19:32:04 -07:00
Jarred Sumner
e6eba3e484 Use the new Lock type
Former-commit-id: fcb04d39a1629047ab0a227c2992922725189ca7
2021-08-20 16:45:01 -07:00
Jarred Sumner
de657fe350 Support directories in Watcher
Former-commit-id: af0813dc3c8cc93874a1903e7b4c92fc5817337a
2021-08-20 16:43:38 -07:00
Jarred Sumner
fb5b0ffedd Obj build step
Former-commit-id: e598d04eb85bf74baa66f555024dd298b1e4b444
2021-08-20 16:42:49 -07:00
Jarred Sumner
9f43f92cfa Add obj build step
Former-commit-id: cd9c4f4dccfce2a5782d285e3ade78c22f1b2a9b
2021-08-20 16:42:34 -07:00
Jarred Sumner
5db15b6ec7 demos -> examples
Former-commit-id: 19a5d395bd41b0a0b854cdf749eb96149f91cbe1
2021-08-20 13:17:57 -07:00
Jack Hanford
f1d3aade3b remove unused code in route-loader, fix CSS load promise when loading /
Former-commit-id: 2b6a239fb6a5ba735b544949e4a770765887fcf8
2021-08-19 10:45:54 -07:00
Jarred Sumner
0826f77101 Fix loading client-side CSS during page transitions
Former-commit-id: f2b6acad6a2e77d3982dd684f88edca222edab06
2021-08-19 00:45:29 -07:00
Jarred Sumner
c92c7beece Log level + onimportcss
Former-commit-id: 12ba9b9bc288573e3a5099adfa14c486c4cc980c
2021-08-19 00:44:44 -07:00
Jarred Sumner
0ba399d8ed etc
Former-commit-id: 67546a63021c0b5b58841a03115fa699ae3e441f
2021-08-18 16:52:35 -07:00
Jack Hanford
abdc26a5fc Get most of the Next.js router working
Former-commit-id: 3521bd1bb606f164f6ef1cdc4cfaae1663c22891
2021-08-18 16:40:23 -07:00
Jarred Sumner
306c7dda61 Merge branch 'main' of github.com:Jarred-Sumner/esdev
Former-commit-id: f4062ec24c4368670a0f5bc336de32fe1df6e821
2021-08-17 21:20:34 -07:00
Jarred Sumner
a703afeddd gitignore
Former-commit-id: 34571e473cf4e83a92ea778f551f51598ed91ac5
2021-08-17 21:20:22 -07:00
Jarred Sumner
6585226de7 Ignore
Former-commit-id: b2c4fce705222612b0457481657db3f42db41d1c
2021-08-17 21:19:45 -07:00
Jack Hanford
28cc70cf50 add some routing methods across hello-next
Former-commit-id: a1b7b13b54d535743e1fc15287f27fd1b3198abc
2021-08-17 21:04:52 -07:00
Jarred Sumner
bbe0a3d58c Merge branch 'main' of github.com:Jarred-Sumner/esdev
Former-commit-id: 7aec17b6232cb51067a289944aa733466c0478fb
2021-08-17 18:49:58 -07:00
Jarred Sumner
68b6e80b91 Prettier http formatt
Former-commit-id: 55951edd7a1a349c1cada83cf52abe73c6d6023c
2021-08-17 18:48:40 -07:00
Jarred Sumner
4b647fdbec v0.0.0-8
Former-commit-id: 106d1754971a0e8465cb9d0e1c73485a93593e05
2021-08-17 18:24:14 -07:00
Jarred Sumner
4a3b03a063 fix static dir
Former-commit-id: 6b396f27940250d33539846ae47596066f12034f
2021-08-17 17:54:23 -07:00
Jarred Sumner
06ef8cf9eb static
Former-commit-id: 1da09a997008e246955167b79883b958e23f0d78
2021-08-17 17:47:19 -07:00
Jarred Sumner
3b6259edf3 fix jsx
Former-commit-id: a9bfcbce261798cdd0c3f8cb09076dc246920b48
2021-08-17 15:25:36 -07:00
Jack Hanford
7a1ca0bc0c add React.Children.only pollyfill
Former-commit-id: e140319390f56979487444529ca49a677264ad57
2021-08-17 15:25:09 -07:00
Jarred Sumner
ae01e9b98d Move bun-framework-next folder, add tsconfig.json
Former-commit-id: cfd7b425f071f200504493fef206afb7c68de6d9
2021-08-17 13:31:33 -07:00
Jarred Sumner
afcbcd231c Fix CSS bug, dont' run HMR code on server
Former-commit-id: 541084b7238d54d77cb13402274718311f2030b4
2021-08-17 12:26:06 -07:00
Jarred Sumner
d7151f07bf hello-next folder
Former-commit-id: dc1c431e6e5c24dd581857090ca872c716cffe07
2021-08-17 04:10:49 -07:00
Jarred Sumner
6997367242 log error on respondWith rejection,
Former-commit-id: 8f6312a17dc9811d54e4dc31d9ada68e98bae891
2021-08-17 04:10:21 -07:00
Jarred Sumner
1e81d4d2a9 fix endsWith
Former-commit-id: 5d89343b0bd923fd7400770d25b12985eb937f70
2021-08-17 04:09:55 -07:00
Jarred Sumner
71943a83e6 Support implicit bun-framework- package prefix
Former-commit-id: a525b9fb31e1b806ef91e1a464a93a607f2bbe32
2021-08-17 04:09:42 -07:00
Jarred Sumner
ca6514c77c Fix JSX runtime when children are 0
Former-commit-id: 094913a99f22888b97696aabe12fc1a5452788d6
2021-08-17 04:09:02 -07:00
Jarred Sumner
d27a599ec2 v0.0.0-6
Former-commit-id: 4a5076bdc2ff91907af0293b38e29f96782d1a83
2021-08-17 03:59:12 -07:00
Jarred Sumner
e0c0dc7191 v0.0.0-5
Former-commit-id: 119b115f69632ca93fbce753f9daf5b91f411c20
2021-08-17 03:56:18 -07:00
Jarred Sumner
574be79253 alright thats the rename
Former-commit-id: 0faf61249e76382dfb1aa8721249474eae920753
2021-08-17 01:44:30 -07:00
Jarred Sumner
209391d01c Update package.json
Former-commit-id: ad0b74a24ae1f9c711d05d08ca9378f0e54f1933
2021-08-16 16:51:27 -07:00
Jarred Sumner
2600c4f4c4 A little less crashy
Former-commit-id: f90ce9e4563de98ad2b6524653821411dd262243
2021-08-15 22:35:47 -07:00
Jarred Sumner
2335780618 rename to bun
Former-commit-id: f982fc85fac3f0120e1851ad4027dd8413216439
2021-08-15 22:17:20 -07:00
Jarred Sumner
bd11b04c18 Support prepending to E.Arrow body
Former-commit-id: ebebca4da402b0cdbeff378ab74227facf34fbf6
2021-08-15 21:50:34 -07:00
Jarred Sumner
41260ecd18 Support multiple route dirs, fix bundling JSX, fix cjs bug, remove warning about unbundled modules in speedy env,
Former-commit-id: ae718dbd05397bed9bc49a77fae20de70b635e82
2021-08-15 21:48:56 -07:00
Jarred Sumner
db4caf0d42 Fix reconnect logic
Former-commit-id: 67fc1488169e9779794b23600401f70a1e812cad
2021-08-15 21:43:53 -07:00
Jarred Sumner
197b3ee34d Fix comma
Former-commit-id: 04c57114d5a7719af387e9d2476d91b17570107c
2021-08-14 23:09:45 -07:00
Jarred Sumner
bfac22d951 fix defines
Former-commit-id: 12db22bc3f5875ee0c43d25f8247983967451c3f
2021-08-14 23:04:29 -07:00
Jarred Sumner
d95ffe6302 .env works
Former-commit-id: 45ee7874f2c8566c3034743161031b0859423f41
2021-08-14 21:28:13 -07:00
Jarred Sumner
76bb26de83 Nested values and recursive nested values
Former-commit-id: 02063fca614201895bb174cce04f920541f760d8
2021-08-14 12:51:06 -07:00
Jarred Sumner
16c7674304 lots
Former-commit-id: 0b8128cb3b4db02f9d33331b4c2c1b595156e6c8
2021-08-14 02:39:44 -07:00
Jarred Sumner
f59892f647 late
Former-commit-id: 1d598bb05a3bac62d86063125e1fe2962f0b5cc6
2021-08-13 02:01:41 -07:00
Jarred Sumner
86642cbdd5 Support tsconfig.json "paths" (instead of just "baseUrl")
Former-commit-id: 02db9729e1d0cddf9343135f46bf843a3d3a34f8
2021-08-12 02:01:29 -07:00
Jarred Sumner
882c963398 Support tsconfig.json "paths" (instead of just "baseUrl")
Former-commit-id: 3780a0cbb033aa7524e220d247067e02af70d998
2021-08-12 02:01:10 -07:00
Jarred Sumner
4d61ce4dd7 FIx .jsb when bundling packages that have multiple nested package.json
Former-commit-id: 1567dafa8c7bbe97c34e42c86995bd193eeeb6d5
2021-08-12 02:00:25 -07:00
Jarred Sumner
3becf2d801 Further reduce allocations in resolver
Former-commit-id: 8ec2529e5ac910e1c46b8e5b912e4a679ff4994c
2021-08-12 01:58:58 -07:00
Jarred Sumner
bae23210f4 Fix __dirname and __pathname
Former-commit-id: 58c1c3b1a5ff24e040d995559baf3162f7e11ab7
2021-08-12 01:58:35 -07:00
Jarred Sumner
6cda74994b Reduce resolver allocations
Former-commit-id: 3833d6059e1fe11590e60a5e2c11f19b2c7c48e2
2021-08-11 21:46:50 -07:00
Jarred Sumner
160f83cf9e When there are errors while generating the .jsb, fail the build.
Former-commit-id: 734f021602ac59aeaef9d7583a927ede94ab644a
2021-08-11 21:46:23 -07:00
Jarred Sumner
3e0a78bc0d Fix parser/printer bugs
Former-commit-id: 8d5fa093546432e803eb066190a3b4b48e5c95f2
2021-08-11 20:22:03 -07:00
Jarred Sumner
d51d39ef32 Add missing jsonStringify
Former-commit-id: d94dfa2ed1ff26079c091331ebcf7d6bfb68df69
2021-08-11 19:43:53 -07:00
Jarred Sumner
70912ec46f Fix incorrect error generated for shorthand properties with initializers
Former-commit-id: 3637987b9ba42805c60ed664769e8fc46fa524f1
2021-08-11 16:22:48 -07:00
Jarred Sumner
3c6d687423 Fix missing check for is_async in shorthand property check
Former-commit-id: 8f2f739bcb303e0ca42853097449133a1630debe
2021-08-11 16:22:08 -07:00
Jarred Sumner
c3c14ff9ce Fix two parser bugs
Former-commit-id: 884b0e3e31e562e4f0e0676819c442842ba9040b
2021-08-11 15:54:15 -07:00
Jarred Sumner
3b0a19efe0 Fix crash when require and import are on the same line
Former-commit-id: 215b03322953ea41de93c5c3c368554d1ab12e92
2021-08-11 14:10:05 -07:00
Jarred Sumner
cfb549b7ce wip
Former-commit-id: e335f297c8ad57af82e74c405351a100524cd7e0
2021-08-11 13:56:32 -07:00
Jarred Sumner
842bb9cba2 go
Former-commit-id: d90f4747fe450c6f5d11d550df5117a9dca9962e
2021-08-11 13:56:03 -07:00
Jarred Sumner
ca90126cc4 client-side entry point works and also generates a correct url on the server
Former-commit-id: 272e52f55e44e998b9238e4173de37bfc6a05a94
2021-08-11 00:02:08 -07:00
Jarred Sumner
10b4b872a2 This is alot
Former-commit-id: 4b2a396611ec03270dc768b70e488b0f5eee2a37
2021-08-10 18:26:16 -07:00
Jarred Sumner
0daff24b16 Fix origin
Former-commit-id: 1abca35a1e83a1ccb2cd39bc04568eb9bc170b15
2021-08-09 02:36:13 -07:00
Jarred Sumner
f74771144e Split up + generate client & server bundles, support framework +router in GenerateNodeModulesBundle , read framework from package.json + rename "publicURL" to "origin" + add import.meta.filepath
Former-commit-id: 1e76ebb5375247231181ec19a6396c6acf4684fb
2021-08-09 02:21:31 -07:00
Jarred Sumner
687b22908f Fix bug when resolving basePath
Former-commit-id: 361e1eef7ff766c0cd395bdbc75dbf1ed5689ce2
2021-08-08 16:41:00 -07:00
Jarred Sumner
0babc4037b Fix missing space when printing class expressions
Former-commit-id: 38413effab0fe4073d64780bcbc898d44c0cb724
2021-08-08 14:17:37 -07:00
Jarred Sumner
33832aa887 Fix infinite loop when class statements are missing an identifier. This may expose a larger issue. We used to panic on lexer errors, but we don't anymore.
Former-commit-id: f4e14ece75b3d381798e317a45833ffa929e900f
2021-08-08 14:17:14 -07:00
Jarred Sumner
063ac7dce5 Fix export default in HMR
Former-commit-id: 4eb1220c53ec179ed40081a3d50a5248ae013af3
2021-08-08 14:16:01 -07:00
Jarred Sumner
e490577a7d More correctly choose the export_default default_name
Former-commit-id: 8b32f4c91e543b9cebba5b5cdd90fa705f471cd4
2021-08-08 14:03:44 -07:00
Jarred Sumner
dbad798c92 eqlComptime
Former-commit-id: 37aaab196be93693511180f50f14618e9eb64312
2021-08-08 14:02:40 -07:00
Jarred Sumner
bdc3308271 getImportedStyles hook
Former-commit-id: 730eb465fb23bcfa23842f293712cfc2cf51d363
2021-08-07 22:09:19 -07:00
Jarred Sumner
de35ad995e SSR!
Former-commit-id: bbc23b382c2eec15436fad632f5efe06e8e8360d
2021-08-07 18:57:41 -07:00
Jarred Sumner
8ce74beafa Clean up logic for choosing when to use filesystem router or public dir
Former-commit-id: 84bb17d9e0dd6e31995afb7b2f49436187fc9f76
2021-08-07 15:24:37 -07:00
Jarred Sumner
7b48e206db Dynamic routes resolve! Just gotta pass query params to the JS correctly
Former-commit-id: 2c4d3184a4f06ba9dd7d27d653834589796ebd0f
2021-08-07 02:28:53 -07:00
Jarred Sumner
4b1f89114e Query String parser with JS integration
Former-commit-id: 8542778c30e9757fa87514f46ff5086d7c8f6bfa
2021-08-06 23:28:13 -07:00
Jarred Sumner
6e4da63abe router almost works
Former-commit-id: a8b9d27bd0946f9c48bd8e4b5b5c2031aa434f28
2021-08-05 23:47:36 -07:00
Jarred Sumner
49929405df alright
Former-commit-id: 66a0a9f4fc554afeef9891915b203772fce2ffc4
2021-08-05 19:54:31 -07:00
Jarred Sumner
c0273a09f1 alright server-side reloading code works
Former-commit-id: a49ef52eec1037014e3c9cda1a09f387a01116b8
2021-08-05 19:48:36 -07:00
Jarred Sumner
56c689d684 Fix SSR
Former-commit-id: 27284f129c72bd3faac27707cc0e6716ad9288e0
2021-08-05 19:45:36 -07:00
Jarred Sumner
5ecf48a21d Fix node_modules.jsb loading in JSC
Former-commit-id: 43366ce3634ca35629e1f8234df86206f6411910
2021-08-04 13:02:16 -07:00
Jarred Sumner
bb00c519c3 Update headers
Former-commit-id: 430460b82f411aaa2c3b87f2e2478de8de24513f
2021-08-04 12:31:33 -07:00
Jarred Sumner
d2b15c0d75 Fix typo in runtime js code
Former-commit-id: 4b996236ef859c3f5aa8b93eae66d8878674f527
2021-08-04 12:30:17 -07:00
Jarred Sumner
5467f2fc1a Fix potential crash when printing summary of node_modules.jsb without any packages in it
Former-commit-id: 928957dffcb907f188f097b13f90901f74caab86
2021-08-04 12:30:04 -07:00
Jarred Sumner
bff37539b9 Fix incorrect module chosen
Former-commit-id: 2cb2628ff3be77ca42db8e40fe94dd6e42891533
2021-08-04 12:29:31 -07:00
Jarred Sumner
88b992abd6 cold
Former-commit-id: 29ceac2a8474322997b89ce217b059bc0c5bc810
2021-08-04 12:18:25 -07:00
Jarred Sumner
340982e58a Fix HMR undefined memory bug when the file doesn't import or export from anything
Former-commit-id: affb0a3580ba137f217ccbdb336f56c0d9948ee8
2021-08-04 12:18:02 -07:00
Jarred Sumner
a23ce8245d Skip empty stack traces
Former-commit-id: 25902aab817f4c075d570fa5774715d3955e25a7
2021-08-04 12:17:26 -07:00
Jarred Sumner
96046fcaa2 Better error message on assertion crash
Former-commit-id: 99cca6f806cdb861b581989a0a17a6bb9fd6b30d
2021-08-04 12:17:01 -07:00
Jarred Sumner
d2d7e08145 Pass allocatorreplace
Former-commit-id: 91a465b58c9860ea601f6a5c1bf4b9238b914932
2021-08-03 23:33:44 -07:00
Jarred Sumner
1aa81cd90d Pass allocator
Former-commit-id: 3a09f407179b44180c9bec9ae221909012fc293b
2021-08-03 23:30:16 -07:00
Jarred Sumner
1167bcef3d Update
Former-commit-id: 977587910ebd7732fd7afe2af4d27df65eed74e4
2021-08-03 23:29:13 -07:00
Jarred Sumner
a9ab385183 Fix
Former-commit-id: 79565ff0f8af2c11a7ef1d9a927443d8b8537963
2021-08-03 23:28:54 -07:00
Jarred Sumner
58fd17867d Threader
Former-commit-id: a13dd6402f54527e87e9afdbbf48e5ff1501c8f9
2021-08-03 19:04:24 -07:00
Jarred Sumner
3b684308c3 ok
Former-commit-id: e7d0ff27193defd870ae29bd9b4d4c2044488eac
2021-08-03 16:01:15 -07:00
Jarred Sumner
3ee7467d66 ok
Former-commit-id: ceef4402d40f701b0527eee038f9f4e5abe3fb70
2021-08-02 23:07:09 -07:00
Jarred Sumner
81f9e0b9e6 fix errorssome names
Former-commit-id: a0ceae3471aa3b16356588645eeca1f2159de356
2021-08-02 22:26:13 -07:00
Jarred Sumner
dbda84ff87 fix errors
Former-commit-id: ac66d6af52f6a2340c57a957bed078f94a8cf8ed
2021-08-02 21:22:58 -07:00
Jarred Sumner
b6e19438ea Lexer is not allowed to panic
Former-commit-id: 98dd448ba21559caac4167f7acd1e8e9f551a0ab
2021-08-02 13:30:06 -07:00
Jarred Sumner
85b6d448ce hm
Former-commit-id: 0dc1c1a74b845d037326f4f2facd786924ca722e
2021-08-01 19:04:38 -07:00
Jarred Sumner
7245f90b2d little bit of errors, little bit of bytecode caching. neither finished
Former-commit-id: c774c395136d58330aa7cad7e9fa434bcef7d5c6
2021-07-30 00:50:29 -07:00
Jarred Sumner
ba743d776a clang-format mostly
Former-commit-id: 1e0462781fc05d22b6f84c2d9f23ce1124a5b9a6
2021-07-29 14:28:50 -07:00
Jarred Sumner
4a8b254652 esmodules work?
Former-commit-id: 5cb5af4416c12518eb195d1b310990fc5c94d6c8
2021-07-28 20:56:29 -07:00
Jarred Sumner
86296897e5 JSClassRef globals work!
Former-commit-id: b1d3eb19872b2c09bda3e9e3b3a4c1f40c3b6a6d
2021-07-28 14:32:51 -07:00
Jarred Sumner
68fa7ec2d0 WIP
Former-commit-id: 60cc85dc0652b34e9c7ec409f32ba635cc4b2e51
2021-07-28 10:56:36 -07:00
Jarred Sumner
d18ff76912 alright console.log works at least
Former-commit-id: 35b5bb035be33001a3c2accbe590bb5312ea4b04
2021-07-27 16:45:02 -07:00
Jarred Sumner
a4a62d9874 Fix build issues
Former-commit-id: 5164b69b57
2021-07-26 18:57:09 -07:00
Jarred Sumner
d9cf78c267 thats a mistake
Former-commit-id: eec8f5afcf
2021-07-26 18:56:04 -07:00
Jarred Sumner
84d7234f24 cool
Former-commit-id: a7214ab61c
2021-07-26 16:39:40 -07:00
Jarred Sumner
5354a44d6a wip
Former-commit-id: 796a9854b4
2021-07-24 15:00:08 -07:00
Jarred Sumner
610c75a492 ok
Former-commit-id: 0d79861a94
2021-07-22 15:41:03 -07:00
Jarred Sumner
e914c5f3d2 most of the bindings!
Former-commit-id: a8a4f28046
2021-07-21 02:07:07 -07:00
Jarred Sumner
f1d6dd2c8b wip
Former-commit-id: f2ea202730
2021-07-19 18:16:32 -07:00
Jarred Sumner
4f2077a4de wrapped!
Former-commit-id: eddbafadfb
2021-07-19 17:15:57 -07:00
Jarred Sumner
79cd2fbfe0 WIP bindings
Former-commit-id: 74e75d6925
2021-07-18 02:12:58 -07:00
Jarred Sumner
e2b9d4c869 1
Former-commit-id: 6d25d816a0
2021-07-16 18:17:00 -07:00
Jarred Sumner
07b26525ca .gitmodules
Former-commit-id: 4a4039fcb3
2021-07-16 18:16:48 -07:00
Jarred Sumner
49ba78767c wip
Former-commit-id: 3f2a2e25ce
2021-07-14 13:11:03 -07:00
Jarred Sumner
d92a3861c9 ts
Former-commit-id: f4381bb297
2021-07-14 00:14:11 -07:00
Jarred Sumner
fea9faaf4c alright
Former-commit-id: ab73c7b323
2021-07-13 10:32:57 -07:00
Jarred Sumner
b1b459435f WIP
Former-commit-id: 6ba2feb8d2
2021-07-11 15:40:14 -07:00
Jarred Sumner
b7d7fac635 this kind of works, but there is a crash when bundling. I think its missing a Stmt.Data.Store.reset()
Former-commit-id: 88aad6aeb1
2021-07-01 05:12:15 -07:00
Jarred Sumner
a1d3191b89 asdasdasd
Former-commit-id: a8536a7337
2021-06-30 02:38:28 -07:00
Jarred Sumner
516f264138 latest
Former-commit-id: cb2ee39bfa
2021-06-30 02:38:23 -07:00
Jarred Sumner
07416311ce Fix crash, fix detecting node_modules, fix undefined not being simplified
Former-commit-id: 3f197d1ce0
2021-06-29 17:47:58 -07:00
Jarred Sumner
ece2a3ccfd alright now it crashes
Former-commit-id: 26745bb5f3
2021-06-29 01:34:38 -07:00
Jarred Sumner
70126c074f require_ref
Former-commit-id: 23e64279d8
2021-06-28 23:14:46 -07:00
Jarred Sumner
adbeb24979 starting to work
Former-commit-id: ae113559c6
2021-06-27 23:36:35 -07:00
Jarred Sumner
b918e7e372 wip
Former-commit-id: 506d9b81a7
2021-06-26 23:12:57 -07:00
Jarred Sumner
b55e64ffa3 I like this direction
Former-commit-id: 3a95a74b7f
2021-06-24 22:55:42 -07:00
Jarred Sumner
d09194f05a Support live-reload and fallback
Former-commit-id: c3f9d77391
2021-06-20 18:15:13 -07:00
Jarred Sumner
6fbfd69699 Rename CSS stress test
Former-commit-id: cbb6f8b1a9
2021-06-20 17:38:55 -07:00
Jarred Sumner
7b549c6551 g
Former-commit-id: 88ac58962e
2021-06-20 17:38:44 -07:00
Jarred Sumner
af0972d6f2 Feature detect fast refresh
Former-commit-id: 73247e5c91
2021-06-19 20:19:50 -07:00
Jarred Sumner
020ce32779 color looper i'll probably get rid of
Former-commit-id: 5015c6a969
2021-06-19 18:30:32 -07:00
Jarred Sumner
0b68ccd742 Use CSSOM for HMR when available.
Former-commit-id: 72f1c676b9
2021-06-19 18:26:43 -07:00
Jarred Sumner
fc1a37cced Show line counts for CSS
Former-commit-id: 3d9028f0ee
2021-06-19 18:23:15 -07:00
Jarred Sumner
7ed1b19d94 CSS HMR!
Former-commit-id: 3f10c87906
2021-06-18 20:48:07 -07:00
Jarred Sumner
6dce0c1e03 100x!!
Former-commit-id: e0fa2e78da
2021-06-18 00:51:11 -07:00
Jarred Sumner
9ca283bb43 CSS scanner works
Former-commit-id: 4ca1e17778
2021-06-17 11:14:20 -07:00
Jarred Sumner
e1677bb774 Skeleton!
Former-commit-id: 6e2c6cd6ea
2021-06-16 16:23:02 -07:00
Jarred Sumner
7eb887edd5 HMR crashily works, started working on CSS Scanner
Former-commit-id: d0f91082fc
2021-06-14 19:45:51 -07:00
Jarred Sumner
122ef023dd extremely close!!!!!
Former-commit-id: 44fce3c5e8
2021-06-14 01:49:53 -07:00
Jarred Sumner
c51c65325f I think thats the JS part of HMR
Former-commit-id: 43380a4d68
2021-06-12 19:10:08 -07:00
Jarred Sumner
f43234bc30 little kqueue fs watcher
Former-commit-id: f93472101a
2021-06-12 00:49:46 -07:00
Jarred Sumner
223410eab3 lil websocket server
Former-commit-id: 19f4c59b42
2021-06-11 17:05:15 -07:00
Jarred Sumner
dc3309d130 alright basic stuff works now. still bugs with JS parser
Former-commit-id: a1dd2a2a32
2021-06-11 10:53:55 -07:00
Jarred Sumner
d2e1c7955b The code looks like it might work
Former-commit-id: 8070da6ec9
2021-06-10 14:57:08 -07:00
Jarred Sumner
f280758fa7 We don't do the exports resolve step, so we must copy the namespace alias
Former-commit-id: b1dd6cf400
2021-06-10 14:56:39 -07:00
Jarred Sumner
a2d8026810 cool!
Former-commit-id: 5ffd8e40b3
2021-06-10 01:07:42 -07:00
Jarred Sumner
0e2fb5d132 Fix expression simplification bug
Former-commit-id: f8b7e45f0c
2021-06-09 22:45:31 -07:00
Jarred Sumner
df01d4de6f ok
Former-commit-id: 8444492e3c
2021-06-09 18:11:17 -07:00
Jarred Sumner
ecda693e38 lots
Former-commit-id: 7346cdaa5a
2021-06-09 13:26:30 -07:00
Jarred Sumner
6a4712f4c9 add prop
Former-commit-id: 94304788dd
2021-06-08 22:34:35 -07:00
Jarred Sumner
3b8cabcc81 Generate summary
Former-commit-id: cdb9af36c1
2021-06-08 02:54:50 -07:00
Jarred Sumner
395deef793 json
Former-commit-id: aa554728f1
2021-06-06 21:17:48 -07:00
Jarred Sumner
9f74fba395 Fix crash that happens when hundreds of files have been parsed and process.env.NODE_ENV is accessed
Former-commit-id: 48e56be05e
2021-06-06 21:17:43 -07:00
Jarred Sumner
f96f299377 hash
Former-commit-id: b97aca7fa1
2021-06-06 21:16:50 -07:00
Jarred Sumner
079fe523d4 Upgrade hash table
Former-commit-id: 5d208f9ea0
2021-06-06 21:16:43 -07:00
Jarred Sumner
13653a93a2 Fix bug printing large scientific notation floats
Former-commit-id: f9b02d2891
2021-06-06 21:15:07 -07:00
Jarred Sumner
19d472c847 hm
Former-commit-id: 024b2ea94e
2021-06-06 18:34:16 -07:00
Jarred Sumner
d49e0a5fa1 WIP node module bundles
Former-commit-id: 797b2ff557
2021-06-06 18:34:01 -07:00
Jarred Sumner
e66466cc1a wip
Former-commit-id: 7d6950da46
2021-06-06 18:33:53 -07:00
Jarred Sumner
69627d8a47 debug-only print
Former-commit-id: af7054c69b
2021-06-06 14:12:52 -07:00
Jarred Sumner
f4245c90e8 Bump schema
Former-commit-id: a93c53651c
2021-06-06 14:12:08 -07:00
Jarred Sumner
913891905f Generate parser versions at compile time
Former-commit-id: 38fe54261d
2021-06-04 19:30:26 -07:00
Jarred Sumner
9dc7f25825 oops typescript
Former-commit-id: 7c400c9b24
2021-06-04 19:30:08 -07:00
Jarred Sumner
faa3c867e2 Fix extra space in printer
Former-commit-id: c17c200cfd
2021-06-04 18:26:55 -07:00
Jarred Sumner
756c41719c Fix extra underscore in ensureValidIdentifier
Former-commit-id: 1cc15b6c20
2021-06-04 17:33:11 -07:00
Jarred Sumner
65f4ea1e18 Generate differnet versions of Bundler, Resolver, and Caches at comptime based on whether we're serving over HTTP
Former-commit-id: e1a8852706
2021-06-04 16:06:38 -07:00
Jarred Sumner
3d827342a5 mostly fix --resolve=disable
Former-commit-id: 981759fafa
2021-06-04 14:46:46 -07:00
Jarred Sumner
ea2a4aa181 rename
Former-commit-id: f584a38a72
2021-06-04 13:50:22 -07:00
Jarred Sumner
7626746904 readme was premature
Former-commit-id: a0d6d02fe8
2021-06-04 03:46:52 -07:00
Jarred Sumner
fa2f60cdd5 fix the leaks
Former-commit-id: 58d77ab827
2021-06-04 02:47:07 -07:00
Jarred Sumner
21a1134de3 okl
Former-commit-id: 0fb2584f15
2021-06-02 20:37:04 -07:00
Jarred Sumner
3bd725d80b keep that
Former-commit-id: 72813b5b48
2021-06-02 20:36:23 -07:00
Jarred Sumner
da0bb118dc HTTP fixes + buffer stdout/in + a little HTTP caching
Former-commit-id: d49df1df57
2021-06-02 16:39:40 -07:00
Jarred Sumner
ddd5ed1cc2 JSX & CJS work end-to-end!
Former-commit-id: 44bab947c6
2021-06-02 12:48:38 -07:00
Jarred Sumner
ee6643ce8b wip
Former-commit-id: a6bc130918
2021-06-01 20:49:49 -07:00
Jarred Sumner
38f1eb0701 linker things
Former-commit-id: 73452660fd
2021-05-31 20:30:40 -07:00
Jarred Sumner
87d01c9f4a Fix printing bugs
Former-commit-id: 52f37e4fe4
2021-05-30 23:35:43 -07:00
Jarred Sumner
dd72bf5ab6 cool
Former-commit-id: 7dc3ee4c89
2021-05-30 18:26:18 -07:00
Jarred Sumner
741d35f0b3 stderr
Former-commit-id: 1d3588ef5a
2021-05-30 15:42:47 -07:00
Jarred Sumner
0e74b0081c Fix indent
Former-commit-id: 4a3b4953ee
2021-05-30 15:32:39 -07:00
Jarred Sumner
d264d4e4ba Fix Define, JSX, use more pointers for property access to minimize calls to memmove
Former-commit-id: 09ceececba
2021-05-30 12:50:08 -07:00
Jarred Sumner
534f9cf509 This'll do for now, I guess.
Former-commit-id: cfda423c01
2021-05-30 01:17:55 -07:00
Jarred Sumner
d1db1fdd79 This blocks approach seems to work
Former-commit-id: 95d5bc78f2
2021-05-30 00:17:17 -07:00
Jarred Sumner
2a54b9f138 Revert "WIP"
This reverts commit b5612b303b [formerly 55dcde581d].


Former-commit-id: 6c2d19c1b0
2021-05-29 19:55:35 -07:00
Jarred Sumner
b5612b303b WIP
Former-commit-id: 55dcde581d
2021-05-29 17:40:00 -07:00
Jarred Sumner
3436ee9ded microp
Former-commit-id: b876a8d480
2021-05-29 13:33:48 -07:00
Jarred Sumner
923e2c5c5d fix crash
Former-commit-id: 0657f16e27
2021-05-29 13:33:37 -07:00
Jarred Sumner
bbc95209f0 microp-optimize hash table stuff
Former-commit-id: 42aaa8eb81
2021-05-29 13:33:31 -07:00
Jarred Sumner
e73da759b9 Move wyhasxh
Former-commit-id: cd91772f2f
2021-05-29 13:32:13 -07:00
Jarred Sumner
6e8e16d916 2
Former-commit-id: f1403901d9
2021-05-28 23:48:10 -07:00
Jarred Sumner
05ec7232bf all
Former-commit-id: 664dbf569c
2021-05-28 23:26:13 -07:00
Jarred Sumner
254a2b779b w
Former-commit-id: 95a3b72e94
2021-05-28 23:04:40 -07:00
Jarred Sumner
12dde03184 wap
Former-commit-id: efe1479299
2021-05-28 23:04:12 -07:00
Jarred Sumner
e01dde3fa2 okay
Former-commit-id: 6dde9a7540
2021-05-28 22:59:46 -07:00
Jarred Sumner
983bc9bbdc maekfile
Former-commit-id: 474df61a86
2021-05-28 22:48:37 -07:00
Jarred Sumner
dbbde8d858 commit
Former-commit-id: 7c576d7b62
2021-05-28 22:47:30 -07:00
Jarred Sumner
a16a5c209c typo
Former-commit-id: 4e1619c17a
2021-05-28 13:34:02 -07:00
Jarred Sumner
494177773f Fix integer overflow
Former-commit-id: 54d9969b4c
2021-05-28 13:33:02 -07:00
Jarred Sumner
5e26ed1320 Remove legacy_octal_loc
Former-commit-id: 91d6bf26b9
2021-05-28 13:32:55 -07:00
Jarred Sumner
0f6a4854e3 keep lexer/loc
Former-commit-id: 2172f3c5e3
2021-05-28 13:27:05 -07:00
Jarred Sumner
089bce8828 launch.json
Former-commit-id: d44fa1ca92
2021-05-28 13:23:29 -07:00
Jarred Sumner
da210d75e8 fixtures
Former-commit-id: e72ad4777c
2021-05-28 13:22:31 -07:00
Jarred Sumner
6e7c954161 gitignore
Former-commit-id: f1bcf07e2b
2021-05-27 21:35:41 -07:00
Jarred Sumner
248354d549 lists
Former-commit-id: cbf0b77e52
2021-05-27 21:35:28 -07:00
Jarred Sumner
db5a78d5f6 stmt experiment
Former-commit-id: b6e7f01e6a
2021-05-27 18:50:20 -07:00
Jarred Sumner
b5173afc44 lots
Former-commit-id: d1b3bce067
2021-05-27 16:38:53 -07:00
Jarred Sumner
f51f303b35 Fix blah = value inside function args
Former-commit-id: 05b9e89417
2021-05-27 15:27:58 -07:00
Jarred Sumner
c6d42bf0a9 Fix yield*
Former-commit-id: ebefe97073
2021-05-27 14:56:53 -07:00
Jarred Sumner
7d1439d570 Fix parsing await inside scopes that contain functions, return the backtracking error in TypeScript
Former-commit-id: 84ea80b813
2021-05-27 14:42:33 -07:00
Jarred Sumner
81f3a52e89 Error message for using node builtins outside of platform == .node
Former-commit-id: 3bcce51fa4
2021-05-27 14:38:28 -07:00
Jarred Sumner
feb7adcd08 faster writes performance
Former-commit-id: 2c212929f8
2021-05-27 00:42:02 -07:00
Jarred Sumner
84be179f7c trying to fix outbase
Former-commit-id: 9b47a8791e
2021-05-27 00:41:33 -07:00
Jarred Sumner
5b4c8449a8 node builtins
Former-commit-id: ca2897b466
2021-05-27 00:40:56 -07:00
Jarred Sumner
8036244eb2 fuckin with absolute paths
Former-commit-id: 453cfa5689
2021-05-27 00:40:47 -07:00
Jarred Sumner
6e46883ca7 Use a normal string to represent template literal content for easier UTF8/UTF16 mixing
Former-commit-id: 7337f27a7e
2021-05-26 18:15:49 -07:00
Jarred Sumner
6a69c971d4 Skip slow path
Former-commit-id: 96a33924fb
2021-05-26 18:15:21 -07:00
Jarred Sumner
4a7067a0a2 FIx parsing 2 digit hex
Former-commit-id: bc794e89ed
2021-05-26 18:14:49 -07:00
Jarred Sumner
3d5e021dea Fix returning parse errors and template tags
Former-commit-id: bb7404d6bc
2021-05-26 18:14:36 -07:00
Jarred Sumner
379566f052 More reliable path storage
Former-commit-id: f47d7b3d2d
2021-05-26 18:13:54 -07:00
Jarred Sumner
112741dfde Fix base_url always null
Former-commit-id: 831a461916
2021-05-26 18:13:39 -07:00
Jarred Sumner
8c41ac8b23 Fix tempalte tags
Former-commit-id: 0e6c46819a
2021-05-26 18:11:55 -07:00
Jarred Sumner
4aee9094a7 detect JSON errors
Former-commit-id: 9b5f317c5b
2021-05-26 18:11:28 -07:00
Jarred Sumner
1a24d77699 I love enums
Former-commit-id: 63b8182b7c
2021-05-26 13:15:52 -07:00
Jarred Sumner
e4b054060e namespace/enum? is that it?
Former-commit-id: 1e0eb4012a
2021-05-26 12:23:09 -07:00
Jarred Sumner
6510697627 print_ast feature flag
Former-commit-id: bc4e76c2a5
2021-05-26 12:21:02 -07:00
Jarred Sumner
0e5955287b import==
Former-commit-id: 9c2c005b58
2021-05-26 10:08:14 -07:00
Jarred Sumner
2fc4a5c564 lexer bug!
Former-commit-id: 84472ed57f
2021-05-26 10:07:56 -07:00
Jarred Sumner
657903c03e cloner
Former-commit-id: d04ef8c53f
2021-05-25 23:34:14 -07:00
Jarred Sumner
a381233e40 like all of typescript lol
Former-commit-id: f2a9dc9eea
2021-05-25 20:01:33 -07:00
Jarred Sumner
5162ab0bbf newline
Former-commit-id: 1cd6b587a2
2021-05-25 20:01:21 -07:00
Jarred Sumner
2b66058a95 add cat, microoptimize the microptimize
Former-commit-id: 28534b2e34
2021-05-25 20:01:16 -07:00
Jarred Sumner
adbbe2963c mostly just zig fmt
Former-commit-id: 6c7eeb2030
2021-05-25 20:01:06 -07:00
Jarred Sumner
f96528adde Malformed headers breaks request parsing
Former-commit-id: 9b206cca2b
2021-05-25 11:12:22 -07:00
Jarred Sumner
ea10dacc92 relative path
Former-commit-id: 06fbc24b11
2021-05-25 01:34:44 -07:00
Jarred Sumner
f234456bd0 w
Former-commit-id: a2637e9016
2021-05-24 12:44:49 -07:00
Jarred Sumner
fe88e7bcf4 try
Former-commit-id: 244ae8c593
2021-05-24 12:44:39 -07:00
Jarred Sumner
35b249d23e ok
Former-commit-id: f7ed006a08
2021-05-24 12:44:23 -07:00
Jarred Sumner
db6ac5f51b ok
Former-commit-id: 5f72442386
2021-05-24 12:44:13 -07:00
Jarred Sumner
6aa88ae931 little separation
Former-commit-id: 1957f0fc23
2021-05-23 11:10:23 -07:00
Jarred Sumner
8a0836c239 The little things
Former-commit-id: 37e17be7aa
2021-05-23 10:20:48 -07:00
Jarred Sumner
cbe78efb9c muck
Former-commit-id: ac4ac8f5a8
2021-05-23 10:05:21 -07:00
Jarred Sumner
7cc2661aa6 http server can load static files...slowly.
Former-commit-id: 45b55a8970
2021-05-22 23:25:25 -07:00
Jarred Sumner
c3d3d70ced wip
Former-commit-id: 63e622f2f3
2021-05-21 17:55:42 -07:00
Jarred Sumner
8b75f56577 pico
Former-commit-id: cee857ac4e
2021-05-20 02:34:42 -07:00
Jarred Sumner
9541d268de cool
Former-commit-id: 6475442469
2021-05-19 23:12:23 -07:00
Jarred Sumner
a58adfcaa2 Starting to work on rutnime
Former-commit-id: 23220fd348
2021-05-19 19:30:24 -07:00
Jarred Sumner
2884b759c3 tread
Former-commit-id: 4f1d32be16
2021-05-18 20:33:45 -07:00
Jarred Sumner
70cc0f47bb decodeEscapeSequences...kiond of?
Former-commit-id: f502d0f1a4
2021-05-18 20:32:55 -07:00
Jarred Sumner
2fac623977 hm
Former-commit-id: 4d6a8f598a
2021-05-18 20:06:08 -07:00
Jarred Sumner
7396fae4e2 Fix DotDefine
Former-commit-id: 78fa4c4f87
2021-05-18 14:40:37 -07:00
Jarred Sumner
904bf17a51 Fix label parsing
Former-commit-id: 1c80859431
2021-05-18 14:07:51 -07:00
Jarred Sumner
e0e32986c7 Fix duplicate exports error
Former-commit-id: 957e871f4a
2021-05-18 13:49:23 -07:00
Jarred Sumner
54730377e2 Fix "in" keyword
Former-commit-id: 0840845d68
2021-05-18 13:13:04 -07:00
Jarred Sumner
28ecf60267 Resolver is fast now!
Former-commit-id: 2ef6397ab9
2021-05-18 02:24:40 -07:00
Jarred Sumner
154e049638 lots
Former-commit-id: 9ccb4dd082
2021-05-16 23:25:12 -07:00
Jarred Sumner
e80f865974 lots
Former-commit-id: d8b1d29656
2021-05-15 17:23:55 -07:00
Jarred Sumner
c88625436c keep
Former-commit-id: 778c24f176
2021-05-13 23:22:08 -07:00
Jarred Sumner
68aa776217 w
Former-commit-id: 248d1a7a93
2021-05-13 21:12:41 -07:00
Jarred Sumner
0666f8151a more utf8
Former-commit-id: e1f996e1b8
2021-05-13 21:10:02 -07:00
Jarred Sumner
1fba2dc20f bugfix
Former-commit-id: dbcddc79fc
2021-05-13 21:09:41 -07:00
Jarred Sumner
ca4120afec bug fixes galore
Former-commit-id: 7243945291
2021-05-13 17:44:50 -07:00
Jarred Sumner
2eb09c1fec okay
Former-commit-id: b42b239344
2021-05-13 13:51:40 -07:00
Jarred Sumner
f6f40b5b64 various bug fixes
Former-commit-id: 87771ba895
2021-05-13 01:24:10 -07:00
Jarred Sumner
bed0227a8f hm
Former-commit-id: 28fce4aac1
2021-05-13 00:46:22 -07:00
Jarred Sumner
9fd6f635cd hm
Former-commit-id: d8828b69d8
2021-05-12 20:40:38 -07:00
Jarred Sumner
f12ed9904b okay I think that's most of resolving packages/imports algorithm!!!
Former-commit-id: 80037859ec
2021-05-12 20:33:58 -07:00
Jarred Sumner
1010bae1a3 cool
Former-commit-id: 51df94e599
2021-05-12 13:17:26 -07:00
Jarred Sumner
c09d7cf839 That's all the errors??
Former-commit-id: f9a74df73d
2021-05-12 13:00:25 -07:00
Jarred Sumner
f8131f42bc okay
Former-commit-id: 2c20d88e8d
2021-05-12 01:46:58 -07:00
Jarred Sumner
175bbdd3c3 now we do resolver??
Former-commit-id: 8df97221a4
2021-05-11 20:49:11 -07:00
Jarred Sumner
515172263b cool
Former-commit-id: cf4d0fe3b6
2021-05-11 20:26:13 -07:00
Jarred Sumner
324784cd6e update
Former-commit-id: a5f1670e92
2021-05-11 18:39:00 -07:00
Jarred Sumner
0c951bd012 opts
Former-commit-id: d75a1deb4a
2021-05-11 17:19:08 -07:00
Jarred Sumner
62dab0703d submodule
Former-commit-id: 033b74cc2a
2021-05-11 11:55:38 -07:00
Jarred Sumner
fc75a0dea6 asdasdasdasd
Former-commit-id: 2b3c0584c6
2021-05-10 20:05:53 -07:00
Jarred Sumner
166c353ddb 1day
Former-commit-id: b7d8fe2f35
2021-05-09 18:57:48 -07:00
Jarred Sumner
ae90b3deea Use try for errors during parsing so that backtracking can happen
Former-commit-id: 7d3b0e7daa
2021-05-08 20:48:20 -07:00
Jarred Sumner
7257094662 Okay this hunks solution seems to work for now. It's not _great_ though.
Former-commit-id: 32cdc13f63
2021-05-08 19:41:52 -07:00
Jarred Sumner
ecabda3ced Fix exporting default twice
Former-commit-id: 2f4cd402e4
2021-05-08 18:12:54 -07:00
Jarred Sumner
18794b18b3 Fix for loop initializer
Former-commit-id: 6b863d5d51
2021-05-08 14:23:52 -07:00
Jarred Sumner
e70ac2ce82 wip
Former-commit-id: 79223472f7
2021-05-07 23:34:16 -07:00
Jarred Sumner
1261560214 This _sort of_ works
Former-commit-id: 8c4917fe60
2021-05-07 20:19:32 -07:00
Jarred Sumner
caa747ba71 wip
Former-commit-id: f4267e2d1f
2021-05-07 14:12:56 -07:00
Jarred Sumner
fad34bb4ab cool
Former-commit-id: 96ff169e46
2021-05-07 01:26:26 -07:00
Jarred Sumner
dd9e7de689 123
Former-commit-id: 741e1513b7
2021-05-05 19:02:36 -07:00
Jarred Sumner
d975ab19db cool
Former-commit-id: 3708dd4484
2021-05-05 19:02:30 -07:00
Jarred Sumner
41c9896e11 I think that fixes the scopes bug
Former-commit-id: 2cbd4c9d80
2021-05-05 19:02:14 -07:00
Jarred Sumner
7a4084a23f alright
Former-commit-id: e0d01a9a91
2021-05-05 13:12:19 -07:00
Jarred Sumner
6be0a4653f damn tho
Former-commit-id: e1df98878d
2021-05-05 03:09:59 -07:00
Jarred Sumner
08961dc3ce Revert "the fast way"
This reverts commit a9ca6c8a07 [formerly 808e5cfac3].


Former-commit-id: 596f3c064a
2021-05-04 16:05:15 -07:00
Jarred Sumner
274b139aa8 hbm
Former-commit-id: 29fe5b730f
2021-05-04 16:03:00 -07:00
Jarred Sumner
5a51ea3957 w
Former-commit-id: 082d184848
2021-05-04 16:02:22 -07:00
Jarred Sumner
ed9981c9c6 re
Former-commit-id: 2e8d6d549d
2021-05-04 16:02:09 -07:00
Jarred Sumner
3ce9f07171 *src
Former-commit-id: 6431b90b9e
2021-05-04 16:01:43 -07:00
Jarred Sumner
adc4e9b23c *
Former-commit-id: 4c60accdc1
2021-05-04 16:01:21 -07:00
Jarred Sumner
a9ca6c8a07 the fast way
Former-commit-id: 808e5cfac3
2021-05-04 15:58:18 -07:00
Jarred Sumner
a432247053 slice
Former-commit-id: 0bfd74af55
2021-05-04 15:56:55 -07:00
Jarred Sumner
d19f939e7d keeper
Former-commit-id: 83ff3453dc
2021-05-04 15:54:17 -07:00
Jarred Sumner
ea84c6dc3c it works???
Former-commit-id: e034383833
2021-05-03 22:37:28 -07:00
Jarred Sumner
ca2a3f69ff hm
Former-commit-id: 1d44b63675
2021-05-03 20:29:38 -07:00
Jarred Sumner
1b3d46d92c maybePrintSpace
Former-commit-id: 468927c14b
2021-05-02 23:45:41 -07:00
Jarred Sumner
0b1fc17636 wip
Former-commit-id: c8a8da370c
2021-05-02 18:24:46 -07:00
Jarred Sumner
26f53dbcd8 shorthand
Former-commit-id: 195c69606b
2021-05-02 16:42:15 -07:00
Jarred Sumner
320e0460e0 various
Former-commit-id: 8db9c7650c
2021-05-02 16:25:14 -07:00
Jarred Sumner
97cb54de2e classes work, excluding name and constructor/super
Former-commit-id: 818d014931
2021-05-02 13:04:55 -07:00
Jarred Sumner
3050d5a1a4 Assorted bugfixes but the next step really is porting tests and fixing
Former-commit-id: f59ec8d6c0
2021-05-01 01:28:40 -07:00
Jarred Sumner
7005f4c43c it prints end to end though doesn't work yet
Former-commit-id: 006ca4f13c
2021-04-30 17:26:17 -07:00
Jarred Sumner
2961b7c8ca inching closure
Former-commit-id: 107310d785
2021-04-30 15:34:31 -07:00
Jarred Sumner
cb639afb57 all in a days work
Former-commit-id: fd56d41c8e
2021-04-30 00:55:15 -07:00
Jarred Sumner
64d35e1dbf ao[slk
Former-commit-id: daf9ea419b
2021-04-29 22:12:22 -07:00
Jarred Sumner
c895f10bbf aoskdp
Former-commit-id: ac83057d08
2021-04-29 21:46:07 -07:00
Jarred Sumner
24d1479ea8 hm
Former-commit-id: 2567243c8d
2021-04-29 20:22:25 -07:00
Jarred Sumner
3731376943 okay
Former-commit-id: 38c7eb73c1
2021-04-29 14:43:30 -07:00
Jarred Sumner
75d2ee53b0 wap
Former-commit-id: a32116476a
2021-04-29 14:03:01 -07:00
Jarred Sumner
1e9e42618b asdasd
Former-commit-id: 4e3f680ac4
2021-04-29 10:29:25 -07:00
Jarred Sumner
cabe773a4f wip
Former-commit-id: b37acf309c
2021-04-28 21:58:02 -07:00
694 changed files with 230502 additions and 9507 deletions

View File

@@ -0,0 +1,68 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/docker-existing-dockerfile
{
"name": "Bun (Ubuntu)",
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../Dockerfile",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/zsh",
"zigLanguageClient.path": "/home/ubuntu/zls/zig-out/bin/zls",
"zig.zigPath": "/build/zig/zig",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[zig]": {
"editor.defaultFormatter": "tiehuis.zig"
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"AugusteRame.zls-vscode",
"ms-vscode.cpptools",
"/home/ubuntu/vscode-zig.vsix",
"vadimcn.vscode-lldb",
"esbenp.prettier-vscode",
"xaver.clang-format"
],
"postCreateCommand": "cd /build/bun; bash /build/getting-started.sh; zsh",
"build": {
"target": "bun.devcontainer",
"cacheFrom": ["bun.devcontainer:latest"],
"args": {}
},
"runArgs": [
"--ulimit",
"memlock=-1:-1",
"--ulimit",
"nofile=65536:65536",
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"workspaceMount": "source=bun,target=/build/bun,type=volume",
"workspaceFolder": "/build/bun",
"mounts": [
"source=bun-install,target=/home/ubuntu/.bun,type=volume",
"source=bun-config,target=/home/ubuntu/.config,type=volume"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 8081, 8080]
// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}

61
.devcontainer/limits.conf Normal file
View File

@@ -0,0 +1,61 @@
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - a user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
# - NOTE: group and wildcard limits are not applied to root.
# To apply a limit to the root user, <domain> must be
# the literal username root.
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
# - chroot - change root to directory (Debian-specific)
#
#<domain> <type> <item> <value>
#
* soft memlock 33554432
* hard memlock 33554432
* soft nofile 33554432
* hard nofile 33554432
#* soft core 0
#root hard core 100000
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#ftp - chroot /ftp
#@student - maxlogins 4
# End of file

View File

@@ -0,0 +1,445 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/common.md
# Maintainer: The VS Code and Codespaces Teams
#
# Syntax: ./common-debian.sh [install zsh flag] [username] [user UID] [user GID] [upgrade packages flag] [install Oh My Zsh! flag] [Add non-free packages]
set -e
INSTALL_ZSH=${1:-"true"}
USERNAME=${2:-"automatic"}
USER_UID=${3:-"automatic"}
USER_GID=${4:-"automatic"}
UPGRADE_PACKAGES=${5:-"true"}
INSTALL_OH_MYS=${6:-"true"}
ADD_NON_FREE_PACKAGES=${7:-"false"}
SCRIPT_DIR="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
MARKER_FILE="/usr/local/etc/vscode-dev-containers/common"
if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
rm -f /etc/profile.d/00-restore-env.sh
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" >/etc/profile.d/00-restore-env.sh
chmod +x /etc/profile.d/00-restore-env.sh
# If in automatic mode, determine if a user already exists, if not use vscode
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
USERNAME=""
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
for CURRENT_USER in ${POSSIBLE_USERS[@]}; do
if id -u ${CURRENT_USER} >/dev/null 2>&1; then
USERNAME=${CURRENT_USER}
break
fi
done
if [ "${USERNAME}" = "" ]; then
USERNAME=vscode
fi
elif [ "${USERNAME}" = "none" ]; then
USERNAME=root
USER_UID=0
USER_GID=0
fi
# Load markers to see which steps have already run
if [ -f "${MARKER_FILE}" ]; then
echo "Marker file found:"
cat "${MARKER_FILE}"
source "${MARKER_FILE}"
fi
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
# Function to call apt-get if needed
apt_get_update_if_needed() {
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update
else
echo "Skipping apt-get update."
fi
}
# Run install apt-utils to avoid debconf warning then verify presence of other common developer tools and dependencies
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
package_list="apt-utils \
openssh-client \
gnupg2 \
dirmngr \
iproute2 \
procps \
lsof \
htop \
net-tools \
psmisc \
curl \
wget \
rsync \
ca-certificates \
unzip \
zip \
nano \
vim-tiny \
less \
jq \
lsb-release \
apt-transport-https \
dialog \
libc6 \
libgcc1 \
libkrb5-3 \
libgssapi-krb5-2 \
libicu[0-9][0-9] \
liblttng-ust0 \
libstdc++6 \
zlib1g \
locales \
sudo \
ncdu \
man-db \
strace \
manpages \
manpages-dev \
init-system-helpers"
# Needed for adding manpages-posix and manpages-posix-dev which are non-free packages in Debian
if [ "${ADD_NON_FREE_PACKAGES}" = "true" ]; then
# Bring in variables from /etc/os-release like VERSION_CODENAME
. /etc/os-release
sed -i -E "s/deb http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME} main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME} main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb-src http:\/\/(deb|httredir)\.debian\.org\/debian ${VERSION_CODENAME} main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME} main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME}-updates main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME}-updates main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb-src http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME}-updates main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME}-updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main contrib non-free/" /etc/apt/sources.list
# Handle bullseye location for security https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html
sed -i "s/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main contrib non-free/" /etc/apt/sources.list
echo "Running apt-get update..."
apt-get update
package_list="${package_list} manpages-posix manpages-posix-dev"
else
apt_get_update_if_needed
fi
# Install libssl1.1 if available
if [[ ! -z $(apt-cache --names-only search ^libssl1.1$) ]]; then
package_list="${package_list} libssl1.1"
fi
# Install appropriate version of libssl1.0.x if available
libssl_package=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'libssl1\.0\.?' 2>&1 || echo '')
if [ "$(echo "$LIlibssl_packageBSSL" | grep -o 'libssl1\.0\.[0-9]:' | uniq | sort | wc -l)" -eq 0 ]; then
if [[ ! -z $(apt-cache --names-only search ^libssl1.0.2$) ]]; then
# Debian 9
package_list="${package_list} libssl1.0.2"
elif [[ ! -z $(apt-cache --names-only search ^libssl1.0.0$) ]]; then
# Ubuntu 18.04, 16.04, earlier
package_list="${package_list} libssl1.0.0"
fi
fi
echo "Packages to verify are installed: ${package_list}"
apt-get -y install --no-install-recommends ${package_list} 2> >(grep -v 'debconf: delaying package configuration, since apt-utils is not installed' >&2)
# Install git if not already installed (may be more recent than distro version)
if ! type git >/dev/null 2>&1; then
apt-get -y install --no-install-recommends git
fi
PACKAGES_ALREADY_INSTALLED="true"
fi
# Get to latest versions of all packages
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
apt_get_update_if_needed
apt-get -y upgrade --no-install-recommends
apt-get autoremove -y
fi
# Ensure at least the en_US.UTF-8 UTF-8 locale is available.
# Common need for both applications and things like the agnoster ZSH theme.
if [ "${LOCALE_ALREADY_SET}" != "true" ] && ! grep -o -E '^\s*en_US.UTF-8\s+UTF-8' /etc/locale.gen >/dev/null; then
echo "en_US.UTF-8 UTF-8" >>/etc/locale.gen
locale-gen
LOCALE_ALREADY_SET="true"
fi
# Create or update a non-root user to match UID/GID.
group_name="${USERNAME}"
if id -u ${USERNAME} >/dev/null 2>&1; then
# User exists, update if needed
if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -g $USERNAME)" ]; then
group_name="$(id -gn $USERNAME)"
groupmod --gid $USER_GID ${group_name}
usermod --gid $USER_GID $USERNAME
fi
if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then
usermod --uid $USER_UID $USERNAME
fi
else
# Create user
if [ "${USER_GID}" = "automatic" ]; then
groupadd $USERNAME
else
groupadd --gid $USER_GID $USERNAME
fi
if [ "${USER_UID}" = "automatic" ]; then
useradd -s /bin/bash --gid $USERNAME -m $USERNAME
else
useradd -s /bin/bash --uid $USER_UID --gid $USERNAME -m $USERNAME
fi
fi
# Add add sudo support for non-root user
if [ "${USERNAME}" != "root" ] && [ "${EXISTING_NON_ROOT_USER}" != "${USERNAME}" ]; then
echo $USERNAME ALL=\(root\) NOPASSWD:ALL >/etc/sudoers.d/$USERNAME
chmod 0440 /etc/sudoers.d/$USERNAME
EXISTING_NON_ROOT_USER="${USERNAME}"
fi
# ** Shell customization section **
if [ "${USERNAME}" = "root" ]; then
user_rc_path="/root"
else
user_rc_path="/home/${USERNAME}"
fi
# Restore user .bashrc defaults from skeleton file if it doesn't exist or is empty
if [ ! -f "${user_rc_path}/.bashrc" ] || [ ! -s "${user_rc_path}/.bashrc" ]; then
cp /etc/skel/.bashrc "${user_rc_path}/.bashrc"
fi
# Restore user .profile defaults from skeleton file if it doesn't exist or is empty
if [ ! -f "${user_rc_path}/.profile" ] || [ ! -s "${user_rc_path}/.profile" ]; then
cp /etc/skel/.profile "${user_rc_path}/.profile"
fi
# .bashrc/.zshrc snippet
rc_snippet="$(
cat <<'EOF'
if [ -z "${USER}" ]; then export USER=$(whoami); fi
if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi
# Display optional first run image specific notice if configured and terminal is interactive
if [ -t 1 ] && [[ "${TERM_PROGRAM}" = "vscode" || "${TERM_PROGRAM}" = "codespaces" ]] && [ ! -f "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed" ]; then
if [ -f "/usr/local/etc/vscode-dev-containers/first-run-notice.txt" ]; then
cat "/usr/local/etc/vscode-dev-containers/first-run-notice.txt"
elif [ -f "/workspaces/.codespaces/shared/first-run-notice.txt" ]; then
cat "/workspaces/.codespaces/shared/first-run-notice.txt"
fi
mkdir -p "$HOME/.config/vscode-dev-containers"
# Mark first run notice as displayed after 10s to avoid problems with fast terminal refreshes hiding it
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed") &)
fi
# Set the default git editor if not already set
if [ -z "$(git config --get core.editor)" ] && [ -z "${GIT_EDITOR}" ]; then
if [ "${TERM_PROGRAM}" = "vscode" ]; then
if [[ -n $(command -v code-insiders) && -z $(command -v code) ]]; then
export GIT_EDITOR="code-insiders --wait"
else
export GIT_EDITOR="code --wait"
fi
fi
fi
EOF
)"
# code shim, it fallbacks to code-insiders if code is not available
cat <<'EOF' >/usr/local/bin/code
#!/bin/sh
get_in_path_except_current() {
which -a "$1" | grep -A1 "$0" | grep -v "$0"
}
code="$(get_in_path_except_current code)"
if [ -n "$code" ]; then
exec "$code" "$@"
elif [ "$(command -v code-insiders)" ]; then
exec code-insiders "$@"
else
echo "code or code-insiders is not installed" >&2
exit 127
fi
EOF
chmod +x /usr/local/bin/code
# systemctl shim - tells people to use 'service' if systemd is not running
cat <<'EOF' >/usr/local/bin/systemctl
#!/bin/sh
set -e
if [ -d "/run/systemd/system" ]; then
exec /bin/systemctl/systemctl "$@"
else
echo '\n"systemd" is not running in this container due to its overhead.\nUse the "service" command to start services intead. e.g.: \n\nservice --status-all'
fi
EOF
chmod +x /usr/local/bin/systemctl
# Codespaces bash and OMZ themes - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
codespaces_bash="$(
cat \
<<'EOF'
# Codespaces bash prompt theme
__bash_prompt() {
local userpart='`export XIT=$? \
&& [ ! -z "${GITHUB_USER}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER} " || echo -n "\[\033[0;32m\]\u " \
&& [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`'
local gitbranch='`\
if [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
export BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null); \
if [ "${BRANCH}" != "" ]; then \
echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH}" \
&& if git ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n " \[\033[1;33m\]✗"; \
fi \
&& echo -n "\[\033[0;36m\]) "; \
fi; \
fi`'
local lightblue='\[\033[1;34m\]'
local removecolor='\[\033[0m\]'
PS1="${userpart} ${lightblue}\w ${gitbranch}${removecolor}\$ "
unset -f __bash_prompt
}
__bash_prompt
EOF
)"
codespaces_zsh="$(
cat \
<<'EOF'
# Codespaces zsh prompt theme
__zsh_prompt() {
local prompt_username
if [ ! -z "${GITHUB_USER}" ]; then
prompt_username="@${GITHUB_USER}"
else
prompt_username="%n"
fi
PROMPT="%{$fg[green]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow
PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd
PROMPT+='$([ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ] && git_prompt_info)' # Git status
PROMPT+='%{$fg[white]%}$ %{$reset_color%}'
unset -f __zsh_prompt
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}(%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[yellow]%}✗%{$fg_bold[cyan]%})"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[cyan]%})"
__zsh_prompt
EOF
)"
# Add RC snippet and custom bash prompt
if [ "${RC_SNIPPET_ALREADY_ADDED}" != "true" ]; then
echo "${rc_snippet}" >>/etc/bash.bashrc
echo "${codespaces_bash}" >>"${user_rc_path}/.bashrc"
echo 'export PROMPT_DIRTRIM=4' >>"${user_rc_path}/.bashrc"
if [ "${USERNAME}" != "root" ]; then
echo "${codespaces_bash}" >>"/root/.bashrc"
echo 'export PROMPT_DIRTRIM=4' >>"/root/.bashrc"
fi
chown ${USERNAME}:${group_name} "${user_rc_path}/.bashrc"
RC_SNIPPET_ALREADY_ADDED="true"
fi
# Optionally install and configure zsh and Oh My Zsh!
if [ "${INSTALL_ZSH}" = "true" ]; then
if ! type zsh >/dev/null 2>&1; then
apt_get_update_if_needed
apt-get install -y zsh
fi
if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then
echo "${rc_snippet}" >>/etc/zsh/zshrc
ZSH_ALREADY_INSTALLED="true"
fi
# Adapted, simplified inline Oh My Zsh! install steps that adds, defaults to a codespaces theme.
# See https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh for official script.
oh_my_install_dir="${user_rc_path}/.oh-my-zsh"
if [ ! -d "${oh_my_install_dir}" ] && [ "${INSTALL_OH_MYS}" = "true" ]; then
template_path="${oh_my_install_dir}/templates/zshrc.zsh-template"
user_rc_file="${user_rc_path}/.zshrc"
umask g-w,o-w
mkdir -p ${oh_my_install_dir}
git clone --depth=1 \
-c core.eol=lf \
-c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \
"https://github.com/ohmyzsh/ohmyzsh" "${oh_my_install_dir}" 2>&1
echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" >${user_rc_file}
sed -i -e 's/ZSH_THEME=.*/ZSH_THEME="codespaces"/g' ${user_rc_file}
mkdir -p ${oh_my_install_dir}/custom/themes
echo "${codespaces_zsh}" >"${oh_my_install_dir}/custom/themes/codespaces.zsh-theme"
# Shrink git while still enabling updates
cd "${oh_my_install_dir}"
git repack -a -d -f --depth=1 --window=1
# Copy to non-root user if one is specified
if [ "${USERNAME}" != "root" ]; then
cp -rf "${user_rc_file}" "${oh_my_install_dir}" /root
chown -R ${USERNAME}:${group_name} "${user_rc_path}"
fi
fi
fi
# Persist image metadata info, script if meta.env found in same directory
meta_info_script="$(
cat <<'EOF'
#!/bin/sh
. /usr/local/etc/vscode-dev-containers/meta.env
# Minimal output
if [ "$1" = "version" ] || [ "$1" = "image-version" ]; then
echo "${VERSION}"
exit 0
elif [ "$1" = "release" ]; then
echo "${GIT_REPOSITORY_RELEASE}"
exit 0
elif [ "$1" = "content" ] || [ "$1" = "content-url" ] || [ "$1" = "contents" ] || [ "$1" = "contents-url" ]; then
echo "${CONTENTS_URL}"
exit 0
fi
#Full output
echo
echo "Development container image information"
echo
if [ ! -z "${VERSION}" ]; then echo "- Image version: ${VERSION}"; fi
if [ ! -z "${DEFINITION_ID}" ]; then echo "- Definition ID: ${DEFINITION_ID}"; fi
if [ ! -z "${VARIANT}" ]; then echo "- Variant: ${VARIANT}"; fi
if [ ! -z "${GIT_REPOSITORY}" ]; then echo "- Source code repository: ${GIT_REPOSITORY}"; fi
if [ ! -z "${GIT_REPOSITORY_RELEASE}" ]; then echo "- Source code release/branch: ${GIT_REPOSITORY_RELEASE}"; fi
if [ ! -z "${BUILD_TIMESTAMP}" ]; then echo "- Timestamp: ${BUILD_TIMESTAMP}"; fi
if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; fi
echo
EOF
)"
if [ -f "${SCRIPT_DIR}/meta.env" ]; then
mkdir -p /usr/local/etc/vscode-dev-containers/
cp -f "${SCRIPT_DIR}/meta.env" /usr/local/etc/vscode-dev-containers/meta.env
echo "${meta_info_script}" >/usr/local/bin/devcontainer-info
chmod +x /usr/local/bin/devcontainer-info
fi
# Write marker file
mkdir -p "$(dirname "${MARKER_FILE}")"
echo -e "\
PACKAGES_ALREADY_INSTALLED=${PACKAGES_ALREADY_INSTALLED}\n\
LOCALE_ALREADY_SET=${LOCALE_ALREADY_SET}\n\
EXISTING_NON_ROOT_USER=${EXISTING_NON_ROOT_USER}\n\
RC_SNIPPET_ALREADY_ADDED=${RC_SNIPPET_ALREADY_ADDED}\n\
ZSH_ALREADY_INSTALLED=${ZSH_ALREADY_INSTALLED}" >"${MARKER_FILE}"
echo "Done!"

View File

@@ -0,0 +1,16 @@
#!/bin/bash
echo "To get started, login to GitHub and clone Bun's GitHub repo into /workspaces/bun"
echo "Make sure to login with a Personal Access Token"
echo "# First time setup"
echo "gh auth login"
echo "gh repo clone Jarred-Sumner/bun . -- --depth=1 --progress -j8"
echo ""
echo "# Compile bun dependencies (zig is already compiled)"
echo "make devcontainer"
echo ""
echo "# Build Bun for development"
echo "make dev"
echo ""
echo "# Run bun"
echo "bun-debug"

View File

@@ -0,0 +1,185 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/github.md
# Maintainer: The VS Code and Codespaces Teams
#
# Syntax: ./github-debian.sh [version]
CLI_VERSION=${1:-"latest"}
GITHUB_CLI_ARCHIVE_GPG_KEY=C99B11DEB97541F0
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80
keyserver hkps://keys.openpgp.org
keyserver hkp://keyserver.pgp.com"
set -e
if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" -o /tmp/vsdc-settings.env 2>/dev/null || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
get_common_setting $1
local keys=${!1}
get_common_setting GPG_KEY_SERVERS true
# Use a temporary locaiton for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" >${GNUPGHOME}/dirmngr.conf
# GPG key download sometimes fails for some reason and retrying fixes it.
local retry_count=0
local gpg_ok="false"
set +e
until [ "${gpg_ok}" = "true" ] || [ "${retry_count}" -eq "5" ]; do
echo "(*) Downloading GPG key..."
(echo "${keys}" | xargs -n 1 gpg --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
((retry_count++))
sleep 10s
fi
done
set -e
if [ "${gpg_ok}" = "false" ]; then
echo "(!) Failed to get gpg key."
exit 1
fi
}
# Figure out correct version of a three part version number is not passed
find_version_from_git_tags() {
local variable_name=$1
local requested_version=${!variable_name}
if [ "${requested_version}" = "none" ]; then return; fi
local repository=$2
local prefix=${3:-"tags/v"}
local separator=${4:-"."}
local last_part_optional=${5:-"false"}
if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then
local escaped_separator=${separator//./\\.}
local last_part
if [ "${last_part_optional}" = "true" ]; then
last_part="(${escaped_separator}[0-9]+)?"
else
last_part="${escaped_separator}[0-9]+"
fi
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+${last_part}$"
local version_list="$(git ls-remote --tags ${repository} | grep -oP "${regex}" | tr -d ' ' | tr "${separator}" "." | sort -rV)"
if [ "${requested_version}" = "latest" ] || [ "${requested_version}" = "current" ] || [ "${requested_version}" = "lts" ]; then
declare -g ${variable_name}="$(echo "${version_list}" | head -n 1)"
else
set +e
declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")"
set -e
fi
fi
if [ -z "${!variable_name}" ] || ! echo "${version_list}" | grep "^${!variable_name//./\\.}$" >/dev/null 2>&1; then
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2
exit 1
fi
echo "${variable_name}=${!variable_name}"
}
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
get_common_setting $1
local keys=${!1}
get_common_setting GPG_KEY_SERVERS true
local keyring_args=""
if [ ! -z "$2" ]; then
keyring_args="--no-default-keyring --keyring $2"
fi
# Use a temporary locaiton for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" >${GNUPGHOME}/dirmngr.conf
# GPG key download sometimes fails for some reason and retrying fixes it.
local retry_count=0
local gpg_ok="false"
set +e
until [ "${gpg_ok}" = "true" ] || [ "${retry_count}" -eq "5" ]; do
echo "(*) Downloading GPG key..."
(echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
((retry_count++))
sleep 10s
fi
done
set -e
if [ "${gpg_ok}" = "false" ]; then
echo "(!) Failed to get gpg key."
exit 1
fi
}
# Function to run apt-get if needed
apt_get_update_if_needed() {
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update
else
echo "Skipping apt-get update."
fi
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
apt_get_update_if_needed
apt-get -y install --no-install-recommends "$@"
fi
}
export DEBIAN_FRONTEND=noninteractive
# Install curl, apt-transport-https, curl, gpg, or dirmngr, git if missing
check_packages curl ca-certificates apt-transport-https dirmngr gnupg2
if ! type git >/dev/null 2>&1; then
apt_get_update_if_needed
apt-get -y install --no-install-recommends git
fi
# Soft version matching
if [ "${CLI_VERSION}" != "latest" ] && [ "${CLI_VERSION}" != "lts" ] && [ "${CLI_VERSION}" != "stable" ]; then
find_version_from_git_tags CLI_VERSION "https://github.com/cli/cli"
version_suffix="=${CLI_VERSION}"
else
version_suffix=""
fi
# Install the GitHub CLI
echo "Downloading github CLI..."
# Import key safely (new method rather than deprecated apt-key approach) and install
. /etc/os-release
receive_gpg_keys GITHUB_CLI_ARCHIVE_GPG_KEY /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages ${VERSION_CODENAME} main" >/etc/apt/sources.list.d/github-cli.list
apt-get update
apt-get -y install "gh${version_suffix}"
rm -rf "/tmp/gh/gnupg"
echo "Done!"

View File

@@ -0,0 +1,7 @@
#!/bin/bash
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://starship.rs/install.sh) -- --platform linux_musl"
echo "eval \"$(starship init zsh)\"" >>~/.zshrc
curl https://github.com/Jarred-Sumner/vscode-zig/releases/download/fork-v1/zig-0.2.5.vsix >/home/ubuntu/vscode-zig.vsix

View File

@@ -0,0 +1,8 @@
#!/bin/bash
curl -L https://github.com/Jarred-Sumner/vscode-zig/releases/download/fork-v1/zig-0.2.5.vsix >/home/ubuntu/vscode-zig.vsix
git clone https://github.com/zigtools/zls /home/ubuntu/zls
cd /home/ubuntu/zls
git checkout e472fca3be6335f16032b48e40ca0d5ffda6ab0a
git submodule update --init --recursive --progress --depth=1
zig build -Drelease-fast

View File

@@ -0,0 +1,9 @@
{
"folders": [
{
// Source code
"name": "Bun",
"path": "bun"
},
]
}

9
.devcontainer/zls.json Normal file
View File

@@ -0,0 +1,9 @@
{
"zig_exe_path": "/build/zig/zig",
"enable_snippets": true,
"warn_style": false,
"enable_semantic_tokens": true,
"operator_completions": true,
"include_at_in_builtins": false,
"max_detail_length": 1048576
}

24
.docker/build-base.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -euxo pipefail
export DOCKER_BUILDKIT=1
docker buildx build \
-t bunbunbunbun/bun-test-base:latest -f Dockerfile.base \
--target bun-test-base \
--platform=linux/$BUILDARCH --build-arg BUILDARCH=$BUILDARCH .
docker buildx build \
--target bun-base \
-f Dockerfile.base \
-t bunbunbunbun/bun-base:latest --platform=linux/$BUILDARCH \
--build-arg BUILDARCH=$BUILDARCH .
docker buildx build \
-t bunbunbunbun/bun-base-with-zig-and-webkit:latest \
-f Dockerfile.base \
--target bun-base-with-zig-and-webkit \
--platform=linux/$BUILDARCH --build-arg BUILDARCH=$BUILDARCH .
docker push bunbunbunbun/bun-test-base:latest
docker push bunbunbunbun/bun-base:latest
docker push bunbunbunbun/bun-base-with-zig-and-webkit:latest

1539
.docker/chrome.json Normal file

File diff suppressed because it is too large Load Diff

14
.docker/chromium.pref Normal file
View File

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

View File

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

3
.docker/debian.list Normal file
View File

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

View File

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

11
.docker/pull.sh Normal file
View File

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

47
.docker/run-dockerfile.sh Normal file
View File

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

9
.docker/run-test.sh Executable file
View File

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

5
.docker/runner.sh Normal file
View File

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

5
.docker/unit-tests.sh Normal file
View File

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

17
.dockerignore Normal file
View File

@@ -0,0 +1,17 @@
node_modules
**/node_modules
src/javascript/jsc/WebKit/LayoutTests
zig-out
zig-build
**/*.o
**/*.a
examples
**/.next
.git
src/javascript/jsc/WebKit
**/CMakeCache.txt
packages/**/bun
packages/**/bun-profile
zig-cache

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
.vscode/launch.json linguist-generated
src/api/schema.d.ts linguist-generated
src/api/schema.js linguist-generated

View File

@@ -0,0 +1,41 @@
name: bun-framework-next
on:
push:
paths:
- packages/bun-framework-next/**/*
branches: [main, bun-framework-next-actions]
pull_request:
paths:
- packages/bun-framework-next/**/*
branches: [main]
jobs:
build:
name: lint, test and build on Node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ["14.x"]
os: [macOS-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install PNPM
uses: pnpm/action-setup@v2.0.1
with:
version: 6.21.0
- name: Install dependencies
run: cd packages/bun-framework-next && pnpm install
- name: Type check bun-framework-next
run: cd packages/bun-framework-next && pnpm check

137
.github/workflows/bun.yml vendored Normal file
View File

@@ -0,0 +1,137 @@
name: bun
on:
push:
branches: [main, bun-actions]
paths-ignore:
- "examples/**"
- "bench/**"
- "README.*"
- "LICENSE"
- ".vscode"
- ".devcontainer"
pull_request:
branches: [main]
paths-ignore:
- "examples/**"
- "bench/**"
- README.*
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TEST_TAG: bun-test'
jobs:
tests:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout submodules
run: git -c submodule."src/javascript/jsc/WebKit".update=none submodule update --init --recursive --depth=1 --progress -j 8
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Pull Base Image
run: bash .docker/pull.sh
- name: Build Release Image
uses: docker/build-push-action@v2
with:
context: .
target: release
tags: bun:${{github.sha}}
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
- name: Build tests
uses: docker/build-push-action@v2
with:
context: .
target: test_base
tags: bun-test:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
builder: ${{ steps.buildx.outputs.name }}
- name: Run test-with-hmr
env:
BUN_TEST_NAME: test-with-hmr
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
RUNNER_TEMP: ${RUNNER_TEMP}
run: bash .docker/runner.sh
- name: Run test-no-hmr
env:
BUN_TEST_NAME: test-no-hmr
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
RUNNER_TEMP: ${RUNNER_TEMP}
run: bash .docker/runner.sh
- name: Run test-bun-create-next
env:
RUNNER_TEMP: ${RUNNER_TEMP}
BUN_TEST_NAME: test-create-next
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
run: bash .docker/runner.sh
- name: Run test-bun-create-react
env:
RUNNER_TEMP: ${RUNNER_TEMP}
BUN_TEST_NAME: test-create-react
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
run: bash .docker/runner.sh
- name: Run test-bun-run
env:
RUNNER_TEMP: ${RUNNER_TEMP}
BUN_TEST_NAME: test-bun-run
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
run: bash .docker/runner.sh
release:
runs-on: self-hosted
needs: tests
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout submodules
run: git -c submodule."src/javascript/jsc/WebKit".update=none submodule update --init --recursive --depth=1 --progress -j 8
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: jarredsumner
password: ${{ secrets.DOCKERHUB_ALT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Pull Base Image
run: bash .docker/pull.sh
- name: Build release image
uses: docker/build-push-action@v2
with:
context: .
target: release
tags: |
ghcr.io/jarred-sumner/bun:${{github.sha}}
ghcr.io/jarred-sumner/bun:edge
jarredsumner/bun:${{github.sha}}
jarredsumner/bun:edge
platforms: |
linux/amd64
labels: |
org.opencontainers.image.title=Bun
org.opencontainers.image.description=Bun is a fast bundler, transpiler, JavaScript Runtime environment and package manager for web software. The image is an Ubuntu 20.04 image with bun preinstalled into /opt/bun.
org.opencontainers.image.vendor=Bun
org.opencontainers.image.source=https://github.com/Jarred-Sumner/bun
org.opencontainers.image.url=https://bun.sh
builder: ${{ steps.buildx.outputs.name }}
push: true

81
.gitignore vendored
View File

@@ -3,4 +3,83 @@ 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
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-*/bun
packages/bun-*/bun-profile
packages/bun-*/debug-bun
packages/bun-*/*.o
packages/bun-cli/postinstall.js
packages/bun-cli/bin/*
bun-test-scratch
misctools/fetch
src/deps/libiconv
src/deps/openssl
src/tests.zig
*.blob
src/deps/s2n-tls
.npm
.npm.gz
bun-binary

27
.gitmodules vendored Normal file
View File

@@ -0,0 +1,27 @@
# [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.git
ignore = dirty
[submodule "src/javascript/jsc/WebKit"]
path = src/javascript/jsc/WebKit
url = https://github.com/Jarred-Sumner/WebKit.git
ignore = dirty
[submodule "src/deps/mimalloc"]
path = src/deps/mimalloc
url = https://github.com/microsoft/mimalloc.git
ignore = dirty
[submodule "src/deps/zlib"]
path = src/deps/zlib
url = https://github.com/cloudflare/zlib.git
ignore = dirty
[submodule "src/deps/libarchive"]
path = src/deps/libarchive
url = https://github.com/libarchive/libarchive.git
ignore = dirty
[submodule "src/deps/boringssl"]
path = src/deps/boringssl
url = https://github.com/google/boringssl.git
ignore = dirty

48
.vscode/c_cpp_properties.json vendored Normal file
View 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
}

687
.vscode/launch.json generated vendored
View File

@@ -1,40 +1,679 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Test",
"type": "lldb",
"request": "launch",
"stdio": null,
"stopOnEntry": false,
"program": "/usr/local/bin/zig",
"name": "HTTP bench",
"program": "${workspaceFolder}/misctools/http_bench",
"args": ["https://example.com", "--count=80"],
"cwd": "${workspaceFolder}",
"args": ["test", "${file}"],
"presentation": {
"hidden": false,
"group": "",
"order": 1
},
"env": {
"TERM": "xterm"
}
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "fetch debug",
"program": "${workspaceFolder}/misctools/fetch",
"args": ["https://lodash.com", "--verbose"],
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "hop",
"program": "hop",
"args": ["swc-linux-arm64-musl-12.0.3.tgz"],
"cwd": "/Users/jarred/Downloads/hop-test",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "hop extract",
"program": "hop",
"args": ["swc-linux-arm64-musl-12.0.3.hop"],
"cwd": "/Users/jarred/Downloads/hop-test",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "fetch debug #2",
"program": "${workspaceFolder}/misctools/fetch",
"args": ["https://registry.npmjs.org/react", "--verbose"],
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "fetch debug #3",
"program": "${workspaceFolder}/misctools/fetch",
"args": ["http://example.com/", "--verbose"],
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "bun create debug",
"program": "bun-debug",
"args": ["create", "hanford/trends", "foo"],
"cwd": "/tmp/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "bun run debug",
"program": "bun-debug",
"args": ["paoskdpoasdk"],
"cwd": "/tmp/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "bun a debug",
"program": "bun-debug",
"args": ["create", "https://github.com/ahfarmer/calculator", "--force"],
"cwd": "/tmp/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "bun routes",
"program": "bun-debug",
"args": [],
"cwd": "${workspaceFolder}/integration/apps/routing",
"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}",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": ".bun",
"program": "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": "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": "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": "Linux Launch",
"program": "${workspaceFolder}/packages/debug-bun-cli-linux-x64/bin/bun-debug",
"args": ["--origin=http://jarred-desktop.local:3000/"],
"cwd": "${workspaceFolder}/examples/hello-next",
"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": "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": "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": "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": "Dazzle serve",
"program": "bun-debug",
"args": ["--origin=http://localhost:5001", "--disable-bun.js", "--disable-hmr"],
"cwd": "/Users/jarred/Build/lattice/apps/dazzle",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Bun",
"program": "bun-debug",
"args": ["bun", "--use=next"],
"cwd": "/Users/jarred/Build/lattice/apps/dazzle",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "unicode check",
"args": ["--disable-hmr"],
"program": "bun-debug",
"cwd": "/Users/jarred/Build/app994",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo .bun",
"program": "bun-debug",
"args": ["bun", "--use=bun-framework-next"],
"cwd": "${workspaceFolder}/examples/hello-next",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "PNPM .bun",
"program": "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": "bun-debug",
"args": [],
"stopAtEntry": false,
"cwd": "/Users/jarred/Build/pnpm-bun/packages/app",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Mixed case resolve",
"program": "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": "bun-debug",
"args": ["bun", "./index.js", "--platform=browser"],
"cwd": "${workspaceFolder}/examples/lotta-modules/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Dev CRA",
"program": "bun-debug",
"args": ["dev", "--platform=browser"],
"cwd": "${workspaceFolder}/examples/hello-create-react-app/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Fragment",
"program": "bun-debug",
"args": [],
"cwd": "${workspaceFolder}/src/test/fixtures",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Context Bun Bug",
"program": "bun-debug",
"args": ["bun", "./code.js"],
"cwd": "/Users/jarred/Build/context/www",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Context Bun",
"program": "bun-debug",
"args": ["bun", "--use=next"],
"cwd": "/Users/jarred/Build/context/www",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Bun-hello",
"program": "bun-debug",
"args": [],
"cwd": "${workspaceFolder}/packages/bun-hello",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Integration Test Dev",
"program": "bun-debug",
"args": [],
"cwd": "${workspaceFolder}/integration/snippets",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Install",
"program": "bun-debug",
"args": ["install", "--backend=clonefile", "--force"],
"cwd": "/Users/jarred/Build/octokit-test",
"env": {
},
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Install #2",
"program": "bun-debug",
"args": ["add", "typescript"],
"cwd": "/tmp/wow-such-npm",
"env": {
},
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Add",
"program": "bun-debug",
"args": ["add", "react"],
"cwd": "/tmp/wow-such-npm",
"env": {
},
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Remove",
"program": "bun-debug",
"args": ["remove", "foo"],
"cwd": "/Users/jarred/Build/athena.yarn",
"env": {
},
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Print Lockfile",
"program": "bun-debug",
"args": ["./bun.lockb"],
"cwd": "/tmp/wow-such-npm",
"env": {
"BUN_CONFIG_SKIP_SAVE_LOCKFILE": "1"
},
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Integration Test Dev (no hmr)",
"program": "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": "lldb",
"request": "launch",
"name": "Context Dev",
"program": "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": "bun-debug",
"args": ["dev"],
"cwd": "${workspaceFolder}/examples/hello-next",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Type-only import",
"program": "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": "bun-debug",
"args": ["dev", "./index.js", "--platform=browser"],
"cwd": "${workspaceFolder}/examples/lotta-modules/",
"console": "internalConsole"
},
{
"type": "lldb",
"request": "launch",
"name": "Demo Build .bun",
"program": "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": "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": "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"
},
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch (other)",
// "program": "bun-debug",
// "args": ["./simple.jsx", "--resolve=disable"],
// "cwd": "${workspaceFolder}/src/test/fixtures",
// "console": "internalConsole"
// },
// {
// "type": "lldb",
// "request": "launch",
// "name": "Dev Launch",
// "program": "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": "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": "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": "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": "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": "bun-debug",
"program": "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
// }
// }
]
}

149
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,149 @@
{
"git.autoRepositoryDetection": "openEditors",
"search.quickOpen.includeSymbols": false,
"search.seedWithNearestWord": true,
"search.smartCase": true,
"search.exclude": {},
"search.followSymlinks": false,
"search.useIgnoreFiles": true,
"zig.buildOnSave": false,
"[zig]": {
"editor.defaultFormatter": "tiehuis.zig"
},
"zig.beforeDebugCmd": "make build-unit ${file} ${filter} ${bin}",
"zig.testCmd": "make test ${file} ${filter} ${bin}",
"lldb.verboseLogging": false,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/*.xcworkspacedata": true,
"**/*.xcscheme": true,
"**/*.pem": true,
"**/*.xcodeproj": true,
"integration/snapshots": true,
"integration/snapshots-no-hmr": true,
"src/javascript/jsc/WebKit": true,
"src/deps/libarchive": true,
"src/deps/mimalloc": true,
"src/deps/s2n-tls": true,
"src/deps/boringssl": true,
"src/deps/openssl": true,
"src/deps/zlib": true,
"integration/snippets/package-json-exports/_node_modules_copy": 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
View File

@@ -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"
}
}
]

316
Dockerfile Normal file
View File

@@ -0,0 +1,316 @@
FROM bunbunbunbun/bun-base:latest as mimalloc
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/mimalloc ${BUN_DIR}/src/deps/mimalloc
RUN cd ${BUN_DIR} && \
make mimalloc && rm -rf src/deps/mimalloc Makefile
FROM bunbunbunbun/bun-base:latest as zlib
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/zlib ${BUN_DIR}/src/deps/zlib
WORKDIR $BUN_DIR
RUN cd $BUN_DIR && \
make zlib && rm -rf src/deps/zlib Makefile
FROM bunbunbunbun/bun-base:latest as libarchive
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/libarchive ${BUN_DIR}/src/deps/libarchive
WORKDIR $BUN_DIR
RUN cd $BUN_DIR && \
make libarchive && rm -rf src/deps/libarchive Makefile
FROM bunbunbunbun/bun-base:latest as boringssl
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/boringssl ${BUN_DIR}/src/deps/boringssl
WORKDIR $BUN_DIR
RUN cd $BUN_DIR && \
make boringssl && rm -rf src/deps/boringssl Makefile
FROM bunbunbunbun/bun-base:latest as picohttp
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
COPY Makefile ${BUN_DIR}/Makefile
COPY src/deps/picohttpparser ${BUN_DIR}/src/deps/picohttpparser
COPY src/deps/*.c ${BUN_DIR}/src/deps
COPY src/deps/*.h ${BUN_DIR}/src/deps
WORKDIR $BUN_DIR
RUN cd $BUN_DIR && \
make picohttp
FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as identifier_cache
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
WORKDIR $BUN_DIR
COPY Makefile ${BUN_DIR}/Makefile
COPY src/js_lexer/identifier_data.zig ${BUN_DIR}/src/js_lexer/identifier_data.zig
COPY src/js_lexer/identifier_cache.zig ${BUN_DIR}/src/js_lexer/identifier_cache.zig
RUN cd $BUN_DIR && \
make identifier-cache && rm -rf zig-cache Makefile
FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as node_fallbacks
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
WORKDIR $BUN_DIR
COPY Makefile ${BUN_DIR}/Makefile
COPY src/node-fallbacks ${BUN_DIR}/src/node-fallbacks
RUN cd $BUN_DIR && \
make node-fallbacks && rm -rf src/node-fallbacks/node_modules Makefile
FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as prepare_release
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
WORKDIR $BUN_DIR
COPY ./src ${BUN_DIR}/src
COPY ./build.zig ${BUN_DIR}/build.zig
COPY ./completions ${BUN_DIR}/completions
COPY ./packages ${BUN_DIR}/packages
COPY ./build-id ${BUN_DIR}/build-id
COPY ./package.json ${BUN_DIR}/package.json
COPY ./misctools ${BUN_DIR}/misctools
COPY Makefile ${BUN_DIR}/Makefile
COPY --from=mimalloc ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/
COPY --from=libarchive ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=picohttp ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/
COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=zlib ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/
COPY --from=identifier_cache ${BUN_DIR}/src/js_lexer/*.blob ${BUN_DIR}/src/js_lexer
WORKDIR ${BUN_DIR}
FROM prepare_release as build_release
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
WORKDIR $BUN_DIR
RUN cd $BUN_DIR && rm -rf $HOME/.cache zig-cache && make \
jsc-bindings-headers \
api \
analytics \
bun_error \
fallback_decoder && rm -rf $HOME/.cache zig-cache && \
mkdir -p $BUN_RELEASE_DIR && \
make release copy-to-bun-release-dir && \
rm -rf $HOME/.cache zig-cache misctools package.json build-id completions build.zig
FROM prepare_release as build_unit
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
WORKDIR $BUN_DIR
ENTRYPOINT [ "/bin/bash" ]
CMD cd $BUN_DIR && \
make \
jsc-bindings-headers \
api \
analytics \
bun_error \
fallback_decoder \
jsc-bindings-mac && \
make \
run-all-unit-tests
FROM bunbunbunbun/bun-base-with-zig-and-webkit:latest as bun.devcontainer
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
ENV WEBKIT_OUT_DIR ${WEBKIT_DIR}
ENV PATH "$ZIG_PATH:$PATH"
ENV JSC_BASE_DIR $WEBKIT_OUT_DIR
ENV LIB_ICU_PATH ${GITHUB_WORKSPACE}/icu/source/lib
ENV BUN_RELEASE_DIR ${BUN_RELEASE_DIR}
ENV PATH "${GITHUB_WORKSPACE}/packages/bun-linux-x64:${GITHUB_WORKSPACE}/packages/bun-linux-aarch64:${GITHUB_WORKSPACE}/packages/debug-bun-linux-x64:${GITHUB_WORKSPACE}/packages/debug-bun-linux-aarch64:$PATH"
ENV PATH "/home/ubuntu/zls/zig-out/bin:$PATH"
ENV BUN_INSTALL /home/ubuntu/.bun
ENV XDG_CONFIG_HOME /home/ubuntu/.config
RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-12 90
COPY .devcontainer/workspace.code-workspace $GITHUB_WORKSPACE/workspace.code-workspace
COPY .devcontainer/zls.json $GITHUB_WORKSPACE/workspace.code-workspace
COPY .devcontainer/limits.conf /etc/security/limits.conf
COPY ".devcontainer/scripts/" /scripts/
COPY ".devcontainer/scripts/getting-started.sh" $GITHUB_WORKSPACE/getting-started.sh
RUN mkdir -p /home/ubuntu/.bun /home/ubuntu/.config $GITHUB_WORKSPACE/bun && \
bash /scripts/common-debian.sh && \
bash /scripts/github.sh && \
bash /scripts/nice.sh && \
bash /scripts/zig-env.sh
COPY .devcontainer/zls.json /home/ubuntu/.config/zls.json
FROM ubuntu:20.04 as release
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
COPY .devcontainer/limits.conf /etc/security/limits.conf
ENV BUN_INSTALL /opt/bun
ENV PATH "/opt/bun/bin:$PATH"
ARG BUILDARCH=amd64
LABEL org.opencontainers.image.title="Bun ${BUILDARCH} (glibc)"
LABEL org.opencontainers.image.source=https://github.com/jarred-sumner/bun
COPY --from=build_release ${BUN_RELEASE_DIR}/bun /opt/bun/bin/bun
WORKDIR /opt/bun
ENTRYPOINT [ "/opt/bun/bin/bun" ]
FROM bunbunbunbun/bun-test-base as test_base
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
ARG BUILDARCH=amd64
RUN groupadd -r chromium && useradd -d ${BUN_DIR} -M -r -g chromium -G audio,video chromium \
&& mkdir -p /home/chromium/Downloads && chown -R chromium:chromium /home/chromium
USER chromium
WORKDIR $BUN_DIR
ENV NPM_CLIENT bun
ENV PATH "${BUN_DIR}/packages/bun-linux-x64:${BUN_DIR}/packages/bun-linux-aarch64:$PATH"
ENV CI 1
ENV BROWSER_EXECUTABLE /usr/bin/chromium
COPY ./integration ${BUN_DIR}/integration
COPY Makefile ${BUN_DIR}/Makefile
COPY package.json ${BUN_DIR}/package.json
COPY .docker/run-test.sh ${BUN_DIR}/run-test.sh
COPY ./bun.lockb ${BUN_DIR}/bun.lockb
# # We don't want to worry about architecture differences in this image
COPY --from=release /opt/bun/bin/bun ${BUN_DIR}/packages/bun-linux-aarch64/bun
COPY --from=release /opt/bun/bin/bun ${BUN_DIR}/packages/bun-linux-x64/bun
USER root
RUN chgrp -R chromium ${BUN_DIR} && chmod g+rwx ${BUN_DIR} && chown -R chromium:chromium ${BUN_DIR}
USER chromium
CMD [ "bash", "run-test.sh" ]
FROM release

145
Dockerfile.base Normal file
View File

@@ -0,0 +1,145 @@
FROM ubuntu:20.04 as bun-base-with-args
FROM bun-base-with-args as bun-base
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
WORKDIR ${GITHUB_WORKSPACE}
RUN apt-get update && \
apt-get install --no-install-recommends -y wget gnupg2 curl lsb-release wget software-properties-common && \
add-apt-repository ppa:longsleep/golang-backports && \
wget https://apt.llvm.org/llvm.sh --no-check-certificate && \
chmod +x llvm.sh && \
./llvm.sh 12 && \
apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
curl \
gnupg2 \
software-properties-common \
cmake \
build-essential \
git \
libssl-dev \
ruby \
liblld-12-dev \
libclang-12-dev \
nodejs \
gcc \
g++ \
npm \
clang-12 \
clang-format-12 \
libc++-12-dev \
libc++abi-12-dev \
lld-12 \
libicu-dev \
wget \
unzip \
tar \
golang-go ninja-build pkg-config automake autoconf libtool curl && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-12 90 && \
update-alternatives --install /usr/bin/cpp cpp /usr/bin/clang++-12 90 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-12 90 && \
npm install -g esbuild
ENV CC=clang-12
ENV CXX=clang++-12
ARG BUILDARCH=amd64
WORKDIR $GITHUB_WORKSPACE
ENV WEBKIT_OUT_DIR ${WEBKIT_DIR}
ENV JSC_BASE_DIR $WEBKIT_OUT_DIR
ENV LIB_ICU_PATH ${GITHUB_WORKSPACE}/icu/source/lib
ENV BUN_RELEASE_DIR ${BUN_RELEASE_DIR}
ENV BUN_DEPS_OUT_DIR ${BUN_DEPS_OUT_DIR}
RUN cd / && mkdir -p $BUN_RELEASE_DIR $BUN_DEPS_OUT_DIR ${BUN_DIR} ${BUN_DEPS_OUT_DIR}
LABEL org.opencontainers.image.title="Bun base image ${BUILDARCH} (glibc)"
LABEL org.opencontainers.image.source=https://github.com/jarred-sumner/bun
FROM bun-base as bun-base-with-zig-and-webkit
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_WORKSPACE=/build
ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig
# Directory extracts to "bun-webkit"
ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit
ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release
ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps
ARG BUN_DIR=${GITHUB_WORKSPACE}/bun
ARG BUILDARCH=amd64
WORKDIR $GITHUB_WORKSPACE
RUN cd $GITHUB_WORKSPACE && \
curl -o zig-linux-$BUILDARCH.zip -L https://github.com/Jarred-Sumner/zig/releases/download/dec20/zig-linux-$BUILDARCH.zip && \
unzip -q zig-linux-$BUILDARCH.zip && \
rm zig-linux-$BUILDARCH.zip;
RUN cd $GITHUB_WORKSPACE && \
curl -o bun-webkit-linux-$BUILDARCH.tar.gz -L https://github.com/Jarred-Sumner/WebKit/releases/download/Bun-v0/bun-webkit-linux-$BUILDARCH.tar.gz && \
tar -xzf bun-webkit-linux-$BUILDARCH.tar.gz && \
rm bun-webkit-linux-$BUILDARCH.tar.gz && \
cat $WEBKIT_OUT_DIR/include/cmakeconfig.h > /dev/null
RUN cd $GITHUB_WORKSPACE && \
curl -o icu4c-66_1-src.tgz -L https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz && \
tar -xzf icu4c-66_1-src.tgz && \
rm icu4c-66_1-src.tgz && \
cd icu/source && \
./configure --enable-static --disable-shared && \
make -j$(nproc)
ENV ZIG "${ZIG_PATH}/zig"
LABEL org.opencontainers.image.title="Bun base image with zig & webkit ${BUILDARCH} (glibc)"
LABEL org.opencontainers.image.source=https://github.com/jarred-sumner/bun
FROM debian:bullseye-slim as bun-test-base
# Original creator:
# LABEL maintainer "Jessie Frazelle <jess@linux.com>"
# Install Chromium
# Yes, including the Google API Keys sucks but even debian does the same: https://packages.debian.org/stretch/amd64/chromium/filelist
RUN apt-get update && apt-get install -y \
chromium \
chromium-l10n \
fonts-liberation \
fonts-roboto \
hicolor-icon-theme \
libcanberra-gtk-module \
libexif-dev \
libgl1-mesa-dri \
libgl1-mesa-glx \
libpangox-1.0-0 \
libv4l-0 \
fonts-symbola \
bash \
make \
psmisc \
curl \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /etc/chromium.d/ \
&& /bin/echo -e 'export GOOGLE_API_KEY="AIzaSyCkfPOPZXDKNn8hhgu3JrA62wIgC93d44k"\nexport GOOGLE_DEFAULT_CLIENT_ID="811574891467.apps.googleusercontent.com"\nexport GOOGLE_DEFAULT_CLIENT_SECRET="kdloedMFGdGla2P1zacGjAQh"' > /etc/chromium.d/googleapikeys && \
curl -L https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && \
apt-get install -y nodejs npm

139
Dockerfile.musl Normal file
View File

@@ -0,0 +1,139 @@
# This doesn't work
# Specifically: there are a number of crashes and segfaults when using musl
# The cause is likely related to differences in pthreads implementations
# It is not just the stack size thing. It's something more complicated and importantly
# There was no meaningful file size difference between musl and glibc
# ARG BUILDARCH=aarch64
# ARG zig_base_image=ghcr.io/jarred-sumner/zig-linux-musl-${BUILDARCH}
# ARG webkit_base_image=ghcr.io/jarred-sumner/bun-webkit-musl-${BUILDARCH}
# FROM ${zig_base_image}:latest AS zig
# FROM ${webkit_base_image}:latest AS webkit
# FROM zig as bun_base
# COPY --from=webkit /webkit /webkit
# ENV PATH "/zig/bin:$PATH"
# ENV JSC_BASE_DIR=/webkit
# ENV LIB_ICU_PATH=/webkit/lib
# ENV BUN_DEPS_OUT_DIR /bun-deps
# ENV STATIC_MUSL_FLAG=-static
# ENV MIMALLOC_OVERRIDE_FLAG="-DMI_OVERRIDE=OFF"
# RUN apk add --no-cache nodejs npm go libtool autoconf pkgconfig automake ninja
# RUN mkdir -p $BUN_DEPS_OUT_DIR;
# WORKDIR /bun
# COPY Makefile /bun/Makefile
# FROM bun_base as mimalloc
# COPY src/deps/mimalloc /bun/src/deps/mimalloc
# RUN make mimalloc;
# FROM bun_base as zlib
# COPY src/deps/zlib /bun/src/deps/zlib
# RUN make zlib;
# FROM bun_base as libarchive
# COPY src/deps/libarchive /bun/src/deps/libarchive
# RUN make libarchive;
# FROM bun_base as boringssl
# COPY src/deps/boringssl /bun/src/deps/boringssl
# RUN make boringssl;
# FROM bun_base as picohttp
# COPY src/deps/picohttpparser /bun/src/deps/picohttpparser
# COPY src/deps/*.c /bun/src/deps
# COPY src/deps/*.h /bun/src/deps
# RUN make picohttp
# FROM bun_base as identifier_cache
# COPY src/js_lexer/identifier_data.zig /bun/src/js_lexer/identifier_data.zig
# COPY src/js_lexer/identifier_cache.zig /bun/src/js_lexer/identifier_cache.zig
# RUN make identifier-cache
# FROM bun_base as node_fallbacks
# COPY src/node-fallbacks /bun/src/node-fallbacks
# RUN make node-fallbacks
# FROM bun_base as prebuild
# WORKDIR /bun
# COPY ./src /bun/src
# COPY ./build.zig /bun/build.zig
# COPY ./completions /bun/completions
# COPY ./packages /bun/packages
# COPY ./build-id /bun/build-id
# COPY ./package.json /bun/package.json
# COPY ./misctools /bun/misctools
# COPY --from=mimalloc /bun-deps/*.o /bun-deps
# COPY --from=libarchive /bun-deps/*.a /bun-deps
# COPY --from=picohttp /bun-deps/*.o /bun-deps
# COPY --from=boringssl /bun-deps/*.a /bun-deps
# COPY --from=zlib /bun-deps/*.a /bun-deps
# COPY --from=node_fallbacks /bun/src/node-fallbacks /bun/src/node-fallbacks
# COPY --from=identifier_cache /bun/src/js_lexer/*.blob /bun/src/js_lexer/
# ENV ICU_FLAGS="-I/webkit/include/wtf $ICU_FLAGS"
# RUN apk add --no-cache chromium && npm install -g esbuild && make \
# jsc-bindings-headers \
# api \
# analytics \
# bun_error \
# fallback_decoder
# FROM prebuild as release
# ENV BUN_RELEASE_DIR /opt/bun
# ENV LIB_ICU_PATH /usr/lib
# RUN apk add icu-static icu-dev && mkdir -p $BUN_RELEASE_DIR; make release \
# copy-to-bun-release-dir
# FROM alpine:3.15 as bun
# COPY --from=release /opt/bun/bun /opt/bun/bin/bun
# ENV BUN_INSTALL /opt/bun
# ENV PATH /opt/bun/bin:$PATH
# LABEL org.opencontainers.image.title="Bun - Linux ${BUILDARCH} (musl)"
# LABEL org.opencontainers.image.source=https://github.com/jarred-sumner/bun
# FROM release as test
# ENV PATH /opt/bun/bin:$PATH
# ENV PATH /bun/packages/bun-linux-aarch64:/bun/packages/bun-linux-x64:$PATH
# ENV BUN_INSTALL /opt/bun
# WORKDIR /bun
# COPY ./integration /bun/integration
# COPY ./integration/snippets/package-json-exports/_node_modules_copy /bun/integration/snippets/package-json-exports/_node_modules_copy
# CMD [ "bash", "-c", "npm install && cd /bun/integration/snippets && npm install && cd /bun && make copy-test-node-modules test-all"]
# # FROM bun

840
Makefile Normal file
View File

@@ -0,0 +1,840 @@
SHELL := /bin/bash # Use bash syntax to be consistent
OS_NAME := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH_NAME_RAW := $(shell uname -m)
BUN_AUTO_UPDATER_REPO = Jarred-Sumner/bun-releases-for-updater
# On Linux ARM64, uname -m reports aarch64
ifeq ($(ARCH_NAME_RAW),aarch64)
ARCH_NAME_RAW = arm64
endif
MIN_MACOS_VERSION = 10.14
MARCH_NATIVE =
ARCH_NAME :=
DOCKER_BUILDARCH =
ifeq ($(ARCH_NAME_RAW),arm64)
ARCH_NAME = aarch64
DOCKER_BUILDARCH = arm64
BREW_PREFIX_PATH = /opt/homebrew
MIN_MACOS_VERSION = 11.0
else
ARCH_NAME = x64
DOCKER_BUILDARCH = amd64
BREW_PREFIX_PATH = /usr/local
MARCH_NATIVE = -march=native
endif
TRIPLET = $(OS_NAME)-$(ARCH_NAME)
PACKAGE_NAME = bun-$(TRIPLET)
PACKAGES_REALPATH = $(realpath packages)
PACKAGE_DIR = $(PACKAGES_REALPATH)/$(PACKAGE_NAME)
DEBUG_PACKAGE_DIR = $(PACKAGES_REALPATH)/debug-$(PACKAGE_NAME)
RELEASE_BUN = $(PACKAGE_DIR)/bun
DEBUG_BIN = $(DEBUG_PACKAGE_DIR)/
DEBUG_BUN = $(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)
BUN_RELEASE_BIN = $(PACKAGE_DIR)/bun
PRETTIER ?= $(shell which prettier || echo "./node_modules/.bin/prettier")
WEBKIT_DIR ?= $(realpath src/javascript/jsc/WebKit)
WEBKIT_RELEASE_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Release
NPM_CLIENT ?= $(shell which npm)
ZIG ?= $(shell which zig || echo -e "error: Missing zig. Please make sure zig is in PATH. Or set ZIG=/path/to-zig-executable")
# We must use the same compiler version for the JavaScriptCore bindings and JavaScriptCore
# If we don't do this, strange memory allocation failures occur.
# This is easier to happen than you'd expect.
# Using realpath here causes issues because clang uses clang++ as a symlink
# so if that's resolved, it won't build for C++
CC = $(shell which clang-12 || which clang)
CXX = $(shell which clang++-12 || which clang++)
# macOS sed is different
SED = $(shell which gsed || which sed)
BUN_DIR ?= $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
BUN_DEPS_DIR ?= $(shell pwd)/src/deps
BUN_DEPS_OUT_DIR ?= $(BUN_DEPS_DIR)
CPUS ?= $(shell nproc)
USER ?= $(echo $USER)
BUN_RELEASE_DIR ?= $(shell pwd)/../bun-release
OPENSSL_VERSION = OpenSSL_1_1_1l
LIBICONV_PATH ?= $(BREW_PREFIX_PATH)/opt/libiconv/lib/libiconv.a
OPENSSL_LINUX_DIR = $(BUN_DEPS_DIR)/openssl/openssl-OpenSSL_1_1_1l
CMAKE_FLAGS_WITHOUT_RELEASE = -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_OSX_DEPLOYMENT_TARGET=$(MIN_MACOS_VERSION)
CMAKE_FLAGS = $(CMAKE_FLAGS_WITHOUT_RELEASE) -DCMAKE_BUILD_TYPE=Release
CFLAGS = $(MACOS_MIN_FLAG)
LIBTOOL=libtoolize
ifeq ($(OS_NAME),darwin)
LIBTOOL=glibtoolize
endif
ifeq ($(OS_NAME),linux)
LIBICONV_PATH =
endif
BUN_TMP_DIR := /tmp/make-bun
BUN_DEPLOY_DIR = /tmp/bun-v$(PACKAGE_JSON_VERSION)/$(PACKAGE_NAME)
DEFAULT_USE_BMALLOC := 1
USE_BMALLOC ?= DEFAULT_USE_BMALLOC
JSC_BASE_DIR ?= ${HOME}/webkit-build
DEFAULT_JSC_LIB :=
ifeq ($(OS_NAME),linux)
DEFAULT_JSC_LIB = $(JSC_BASE_DIR)/lib
endif
ifeq ($(OS_NAME),darwin)
DEFAULT_JSC_LIB = $(BUN_DEPS_DIR)
endif
JSC_LIB ?= $(DEFAULT_JSC_LIB)
JSC_INCLUDE_DIR ?= $(JSC_BASE_DIR)/include
ZLIB_INCLUDE_DIR ?= $(BUN_DEPS_DIR)/zlib
ZLIB_LIB_DIR ?= $(BUN_DEPS_DIR)/zlib
JSC_FILES := $(JSC_LIB)/libJavaScriptCore.a $(JSC_LIB)/libWTF.a $(JSC_LIB)/libbmalloc.a
# https://github.com/microsoft/mimalloc/issues/512
# Linking mimalloc via object file on macOS x64 can cause heap corruption
MIMALLOC_FILE = libmimalloc.o
MIMALLOC_INPUT_PATH = CMakeFiles/mimalloc-obj.dir/src/static.c.o
DEFAULT_LINKER_FLAGS =
JSC_BUILD_STEPS :=
ifeq ($(OS_NAME),linux)
JSC_BUILD_STEPS += jsc-build-linux
DEFAULT_LINKER_FLAGS= -pthread -ldl
endif
ifeq ($(OS_NAME),darwin)
JSC_BUILD_STEPS += jsc-build-mac jsc-copy-headers
MIMALLOC_FILE = libmimalloc.a
MIMALLOC_INPUT_PATH = libmimalloc.a
endif
MACOSX_DEPLOYMENT_TARGET=$(MIN_MACOS_VERSION)
MACOS_MIN_FLAG=
POSIX_PKG_MANAGER=sudo apt
STRIP ?= $(shell which llvm-strip || which llvm-strip-12 || echo "Missing llvm-strip. Please pass it in the STRIP environment var"; exit 1;)
HOMEBREW_PREFIX ?= $(BREW_PREFIX_PATH)
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))
MAC_INCLUDE_DIRS := -I$(WEBKIT_RELEASE_DIR)/JavaScriptCore/PrivateHeaders \
-I$(WEBKIT_RELEASE_DIR)/WTF/Headers \
-I$(WEBKIT_RELEASE_DIR)/ICU/Headers \
-I$(WEBKIT_RELEASE_DIR)/ \
-Isrc/javascript/jsc/bindings/ \
-I$(WEBKIT_DIR)/Source/bmalloc
LINUX_INCLUDE_DIRS := -I$(JSC_INCLUDE_DIR) \
-Isrc/javascript/jsc/bindings/
INCLUDE_DIRS :=
ifeq ($(OS_NAME),linux)
INCLUDE_DIRS += $(LINUX_INCLUDE_DIRS)
endif
ifeq ($(OS_NAME),darwin)
MACOS_MIN_FLAG=-mmacosx-version-min=$(MIN_MACOS_VERSION)
POSIX_PKG_MANAGER=brew
INCLUDE_DIRS += $(MAC_INCLUDE_DIRS)
endif
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
ICU_FLAGS ?=
# TODO: find a way to make this more resilient
# Ideally, we could just look up the linker search paths
LIB_ICU_PATH ?= $(BUN_DEPS_DIR)
ifeq ($(OS_NAME),linux)
ICU_FLAGS += $(LIB_ICU_PATH)/libicuuc.a $(LIB_ICU_PATH)/libicudata.a $(LIB_ICU_PATH)/libicui18n.a
endif
ifeq ($(OS_NAME),darwin)
ICU_FLAGS += -l icucore \
$(MACOS_ICU_FILES) \
-I$(MACOS_ICU_INCLUDE)
endif
BORINGSSL_PACKAGE = --pkg-begin boringssl $(BUN_DEPS_DIR)/boringssl.zig --pkg-end
CLANG_FLAGS = $(INCLUDE_DIRS) \
-std=gnu++17 \
-DSTATICALLY_LINKED_WITH_JavaScriptCore=1 \
-DSTATICALLY_LINKED_WITH_WTF=1 \
-DSTATICALLY_LINKED_WITH_BMALLOC=1 \
-DBUILDING_WITH_CMAKE=1 \
-DNDEBUG=1 \
-DNOMINMAX \
-DIS_BUILD \
-g \
-DENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=0 \
-DBUILDING_JSCONLY__ \
-DASSERT_ENABLED=0 \
-fPIE
# This flag is only added to webkit builds on Apple platforms
# It has something to do with ICU
ifeq ($(OS_NAME), darwin)
CLANG_FLAGS += -DDU_DISABLE_RENAMING=1 \
$(MACOS_MIN_FLAG) -lstdc++
endif
ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(BUN_DEPS_OUT_DIR)/$(MIMALLOC_FILE) \
$(BUN_DEPS_OUT_DIR)/libz.a \
$(BUN_DEPS_OUT_DIR)/libarchive.a \
$(BUN_DEPS_OUT_DIR)/libssl.a \
$(BUN_DEPS_OUT_DIR)/picohttpparser.o \
ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO) $(BUN_DEPS_OUT_DIR)/libcrypto.boring.a
PLATFORM_LINKER_FLAGS =
STATIC_MUSL_FLAG ?=
ifeq ($(OS_NAME), linux)
PLATFORM_LINKER_FLAGS = \
-fuse-ld=lld \
-lc \
-Wl,-z,now \
-Wl,--as-needed \
-Wl,--gc-sections \
-Wl,-z,stack-size=12800000 \
-ffunction-sections \
-fdata-sections \
-static-libstdc++ \
-static-libgcc \
${STATIC_MUSL_FLAG}
endif
BUN_LLD_FLAGS = $(OBJ_FILES) \
${ICU_FLAGS} \
${JSC_FILES} \
$(ARCHIVE_FILES) \
$(LIBICONV_PATH) \
$(CLANG_FLAGS) \
$(DEFAULT_LINKER_FLAGS) \
$(PLATFORM_LINKER_FLAGS)
bun: vendor identifier-cache build-obj bun-link-lld-release bun-codesign-release-local
vendor-without-check: api analytics node-fallbacks runtime_js fallback_decoder bun_error mimalloc picohttp zlib boringssl libarchive
boringssl-build:
cd $(BUN_DEPS_DIR)/boringssl && mkdir -p build && cd build && cmake $(CMAKE_FLAGS) -GNinja .. && ninja
boringssl-copy:
cp $(BUN_DEPS_DIR)/boringssl/build/ssl/libssl.a $(BUN_DEPS_OUT_DIR)/libssl.a
cp $(BUN_DEPS_DIR)/boringssl/build/crypto/libcrypto.a $(BUN_DEPS_OUT_DIR)/libcrypto.boring.a
boringssl: boringssl-build boringssl-copy
libarchive:
cd $(BUN_DEPS_DIR)/libarchive; \
(make clean || echo ""); \
(./build/clean.sh || echo ""); \
./build/autogen.sh; \
CFLAGS=$(CFLAGS) CC=$(CC) ./configure --disable-shared --enable-static --with-pic --disable-bsdtar --disable-bsdcat --disable-rpath --enable-posix-regex-lib --without-xml2 --without-expat --without-openssl --without-iconv --without-zlib; \
make -j${CPUS}; \
cp ./.libs/libarchive.a $(BUN_DEPS_OUT_DIR)/libarchive.a;
tgz:
$(ZIG) build tgz-obj -Drelease-fast
$(CXX) $(PACKAGE_DIR)/tgz.o -g -o ./misctools/tgz $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES)
rm -rf $(PACKAGE_DIR)/tgz.o
tgz-debug:
$(ZIG) build tgz-obj
$(CXX) $(DEBUG_PACKAGE_DIR)/tgz.o -g -o ./misctools/tgz $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES)
rm -rf $(DEBUG_PACKAGE_DIR)/tgz.o
vendor: require init-submodules vendor-without-check
zlib:
cd $(BUN_DEPS_DIR)/zlib; cmake $(CMAKE_FLAGS) .; make CFLAGS=$(CFLAGS);
cp $(BUN_DEPS_DIR)/zlib/libz.a $(BUN_DEPS_OUT_DIR)/libz.a
docker-login:
docker login ghcr.io --username jarred@jarredsumner.com
docker-push-base:
BUILDKIT=1 docker build -f Dockerfile.base --build-arg GITHUB_WORKSPACE=/build --platform=linux/$(DOCKER_BUILDARCH) --tag bun-base --target base .
BUILDKIT=1 docker build -f Dockerfile.base --build-arg GITHUB_WORKSPACE=/build --platform=linux/$(DOCKER_BUILDARCH) --tag bun-base-with-zig-and-webkit --target base-with-zig-and-webkit .
BUILDKIT=1 docker build -f Dockerfile.base --build-arg GITHUB_WORKSPACE=/build --platform=linux/$(DOCKER_BUILDARCH) --tag bun-base-with-args --target base-with-args .
docker tag bun-base ghcr.io/jarred-sumner/bun-base:latest
docker push ghcr.io/jarred-sumner/bun-base:latest
docker tag bun-base-with-zig-and-webkit ghcr.io/jarred-sumner/bun-base-with-zig-and-webkit:latest
docker push ghcr.io/jarred-sumner/bun-base-with-zig-and-webkit:latest
docker tag bun-base-with-args ghcr.io/jarred-sumner/bun-base-with-args:latest
docker push ghcr.io/jarred-sumner/bun-base-with-args:latest
require:
@echo "Checking if the required utilities are available..."
@cmake --version >/dev/null 2>&1 || (echo -e "ERROR: cmake is required."; exit 1)
@esbuild --version >/dev/null 2>&1 || (echo -e "ERROR: esbuild is required."; exit 1)
@npm --version >/dev/null 2>&1 || (echo -e "ERROR: npm is required."; exit 1)
@which aclocal > /dev/null || (echo -e "ERROR: automake is required. Install with:\n\n $(POSIX_PKG_MANAGER) install automake"; exit 1)
@which $(LIBTOOL) > /dev/null || (echo -e "ERROR: libtool is required. Install with:\n\n $(POSIX_PKG_MANAGER) install libtool"; exit 1)
@which ninja > /dev/null || (echo -e "ERROR: Ninja is required. Install with:\n\n $(POSIX_PKG_MANAGER) install ninja"; exit 1)
@echo "You have the dependencies installed! Woo"
init-submodules:
git submodule update --init --recursive --progress --depth=1
build-obj:
$(ZIG) build obj -Drelease-fast
sign-macos-x64:
gon sign.macos-x64.json
sign-macos-aarch64:
gon sign.macos-aarch64.json
cls:
@echo "\n\n---\n\n"
release: all-js jsc-bindings-mac build-obj cls bun-link-lld-release release-bin-entitlements
jsc-check:
@ls $(JSC_BASE_DIR) >/dev/null 2>&1 || (echo "Failed to access WebKit build. Please compile the WebKit submodule using the Dockerfile at $(shell pwd)/src/javascript/WebKit/Dockerfile and then copy from /output in the Docker container to $(JSC_BASE_DIR). You can override the directory via JSC_BASE_DIR. \n\n DOCKER_BUILDKIT=1 docker build -t bun-webkit $(shell pwd)/src/javascript/jsc/WebKit -f $(shell pwd)/src/javascript/jsc/WebKit/Dockerfile --progress=plain\n\n docker container create bun-webkit\n\n # Get the container ID\n docker container ls\n\n docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $(JSC_BASE_DIR)" && exit 1)
@ls $(JSC_INCLUDE_DIR) >/dev/null 2>&1 || (echo "Failed to access WebKit include directory at $(JSC_INCLUDE_DIR)." && exit 1)
@ls $(JSC_LIB) >/dev/null 2>&1 || (echo "Failed to access WebKit lib directory at $(JSC_LIB)." && exit 1)
all-js: runtime_js fallback_decoder bun_error node-fallbacks
api:
$(NPM_CLIENT) 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
$(ZIG) fmt src/api/schema.zig
$(PRETTIER) --write src/api/schema.js
$(PRETTIER) --write src/api/schema.d.ts
node-fallbacks:
@cd src/node-fallbacks; $(NPM_CLIENT) install; $(NPM_CLIENT) 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
runtime_js_dev:
@NODE_ENV=development esbuild --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
bun_error:
@cd packages/bun-error; $(NPM_CLIENT) install; $(NPM_CLIENT) run --silent build
generate-install-script:
@rm -f $(PACKAGES_REALPATH)/bun/install.js
@esbuild --log-level=error --define:BUN_VERSION="\"$(PACKAGE_JSON_VERSION)\"" --define:process.env.NODE_ENV="\"production\"" --platform=node --format=cjs $(PACKAGES_REALPATH)/bun/install.ts > $(PACKAGES_REALPATH)/bun/install.js
fetch:
$(ZIG) build -Drelease-fast fetch-obj
$(CXX) $(PACKAGE_DIR)/fetch.o -g -O3 -o ./misctools/fetch $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES)
rm -rf $(PACKAGE_DIR)/fetch.o
fetch-debug:
$(ZIG) build fetch-obj
$(CXX) $(DEBUG_PACKAGE_DIR)/fetch.o -g -O3 -o ./misctools/fetch $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES)
httpbench-debug:
$(ZIG) build httpbench-obj
$(CXX) $(DEBUG_PACKAGE_DIR)/httpbench.o -g -o ./misctools/http_bench $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES)
rm -rf $(DEBUG_PACKAGE_DIR)/httpbench.o
httpbench-release:
$(ZIG) build -Drelease-fast httpbench-obj
$(CXX) $(PACKAGE_DIR)/httpbench.o -g -O3 -o ./misctools/http_bench $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES)
rm -rf $(PACKAGE_DIR)/httpbench.o
bun-codesign-debug:
bun-codesign-release-local:
check-glibc-version-dependency:
@objdump -T $(RELEASE_BUN) | ((grep -qe "GLIBC_2.3[0-9]") && { echo "Glibc 2.3X detected, this will break the binary"; exit 1; }) || true
ifeq ($(OS_NAME),darwin)
# Hardened runtime will not work with debugging
bun-codesign-debug:
codesign --entitlements $(realpath entitlements.plist) --force --timestamp --sign "$(CODESIGN_IDENTITY)" -vvvv --deep --strict $(DEBUG_BUN)
bun-codesign-release-local:
codesign --entitlements $(realpath entitlements.plist) --options runtime --force --timestamp --sign "$(CODESIGN_IDENTITY)" -vvvv --deep --strict $(RELEASE_BUN)
codesign --entitlements $(realpath entitlements.plist) --options runtime --force --timestamp --sign "$(CODESIGN_IDENTITY)" -vvvv --deep --strict $(PACKAGE_DIR)/bun-profile
endif
jsc: jsc-build jsc-copy-headers jsc-bindings
jsc-build: $(JSC_BUILD_STEPS)
jsc-bindings: jsc-bindings-headers jsc-bindings-mac
clone-submodules:
git -c submodule."src/javascript/jsc/WebKit".update=none submodule update --init --recursive --depth=1 --progress
devcontainer: clone-submodules mimalloc zlib libarchive boringssl picohttp identifier-cache node-fallbacks jsc-bindings-headers api analytics bun_error fallback_decoder jsc-bindings-mac dev runtime_js_dev
jsc-bindings-headers:
rm -f /tmp/build-jsc-headers src/javascript/jsc/bindings/headers.zig
touch src/javascript/jsc/bindings/headers.zig
mkdir -p src/javascript/jsc/bindings-obj/
$(ZIG) build headers-obj
$(CXX) $(PLATFORM_LINKER_FLAGS) -g $(DEBUG_BIN)/headers.o -W -o /tmp/build-jsc-headers $(DEFAULT_LINKER_FLAGS) -lc $(ARCHIVE_FILES);
/tmp/build-jsc-headers
$(ZIG) translate-c src/javascript/jsc/bindings/headers.h > src/javascript/jsc/bindings/headers.zig
$(ZIG) run misctools/headers-cleaner.zig -lc
$(SED) -i '/pub const __darwin/d' src/javascript/jsc/bindings/headers.zig || echo "";
$(SED) -i '/pub const __builtin/d' src/javascript/jsc/bindings/headers.zig || echo "";
$(SED) -i '/pub const int/d' src/javascript/jsc/bindings/headers.zig || echo "";
$(SED) -i '/pub const uint/d' src/javascript/jsc/bindings/headers.zig || echo "";
$(SED) -i '/pub const intmax/d' src/javascript/jsc/bindings/headers.zig || echo "";
$(SED) -i '/pub const uintmax/d' src/javascript/jsc/bindings/headers.zig || echo "";
$(SED) -i '/pub const max_align_t/{N;N;N;d;}' src/javascript/jsc/bindings/headers.zig
$(SED) -i '/pub const ZigErrorCode/d' src/javascript/jsc/bindings/headers.zig
$(SED) -i '/pub const JSClassRef/d' src/javascript/jsc/bindings/headers.zig
$(ZIG) fmt src/javascript/jsc/bindings/headers.zig
MIMALLOC_OVERRIDE_FLAG ?=
bump:
expr $(BUILD_ID) + 1 > build-id
identifier-cache:
$(ZIG) run src/js_lexer/identifier_data.zig
tag:
git tag $(BUN_BUILD_TAG)
git push --tags
cd ../bun-releases-for-updater && echo $(BUN_BUILD_TAG) > bumper && git add bumper && git commit -m "Update latest release" && git tag $(BUN_BUILD_TAG) && git push
prepare-release: tag release-create
release-create-auto-updater:
release-create:
gh release create --title "Bun v$(PACKAGE_JSON_VERSION)" "$(BUN_BUILD_TAG)"
gh release create --repo=$(BUN_AUTO_UPDATER_REPO) --title "Bun v$(PACKAGE_JSON_VERSION)" "$(BUN_BUILD_TAG)" -n "See https://github.com/Jarred-Sumner/bun/releases/tag/$(BUN_BUILD_TAG) for release notes. Using the install script or bun upgrade is the recommended way to install Bun. Join Bun's Discord to get access https://bun.sh/discord"
release-bin-entitlements:
release-bin-generate-zip:
release-bin-codesign:
ifeq ($(OS_NAME),darwin)
# Without this, JIT will fail on aarch64
# strip will remove the entitlements.plist
# which, in turn, will break JIT
release-bin-entitlements:
codesign --entitlements $(realpath entitlements.plist) --options runtime --force --timestamp --sign "$(CODESIGN_IDENTITY)" -vvvv --deep --strict $(PACKAGE_DIR)/bun
codesign --entitlements $(realpath entitlements.plist) --options runtime --force --timestamp --sign "$(CODESIGN_IDENTITY)" -vvvv --deep --strict $(PACKAGE_DIR)/bun-profile
# macOS expects a specific directory structure for the zip file
# ditto lets us generate it similarly to right clicking "Compress" in Finder
release-bin-generate-zip:
dot_clean -vnm /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET)
cd /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET) && \
codesign --entitlements $(realpath entitlements.plist) --options runtime --force --timestamp --sign "$(CODESIGN_IDENTITY)" -vvvv --deep --strict bun
ditto -ck --rsrc --sequesterRsrc --keepParent /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET) $(BUN_DEPLOY_ZIP)
release-bin-codesign:
xcrun notarytool submit --wait $(BUN_DEPLOY_ZIP) --keychain-profile "bun"
else
release-bin-generate-zip:
cd /tmp/bun-$(PACKAGE_JSON_VERSION)/ && zip -r bun-$(TRIPLET).zip bun-$(TRIPLET)
endif
BUN_DEPLOY_ZIP = /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET).zip
release-bin-generate-copy:
rm -rf /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET) $(BUN_DEPLOY_ZIP)
mkdir -p /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET)
cp $(BUN_RELEASE_BIN) /tmp/bun-$(PACKAGE_JSON_VERSION)/bun-$(TRIPLET)/bun
release-bin-generate: release-bin-generate-copy release-bin-generate-zip
release-bin-check-version:
test $(shell eval $(BUN_RELEASE_BIN) --version) = $(PACKAGE_JSON_VERSION)
release-bin-check: release-bin-check-version
ifeq ($(OS_NAME),linux)
release-bin-check: release-bin-check-version
# force it to run
@make -B check-glibc-version-dependency
endif
release-bin-without-push: test-all release-bin-check release-bin-generate release-bin-codesign
release-bin: release-bin-without-push release-bin-push
release-bin-dir:
echo $(PACKAGE_DIR)
release-bin-push:
gh release upload $(BUN_BUILD_TAG) --clobber $(BUN_DEPLOY_ZIP)
gh release upload $(BUN_BUILD_TAG) --clobber $(BUN_DEPLOY_ZIP) --repo $(BUN_AUTO_UPDATER_REPO)
dev-obj:
$(ZIG) build obj
dev-obj-linux:
$(ZIG) build obj -Dtarget=x86_64-linux-gnu
dev: mkdir-dev dev-obj bun-link-lld-debug bun-codesign-debug
mkdir-dev:
mkdir -p $(DEBUG_PACKAGE_DIR)/bin
test-install:
cd integration/scripts && $(NPM_CLIENT) install
test-all: test-install test-with-hmr test-no-hmr test-create-next test-create-react test-bun-run
copy-test-node-modules:
rm -rf integration/snippets/package-json-exports/node_modules || echo "";
cp -r integration/snippets/package-json-exports/_node_modules_copy integration/snippets/package-json-exports/node_modules || echo "";
kill-bun:
-killall -9 bun bun-debug
test-dev-create-next:
BUN_BIN=$(DEBUG_BUN) bash integration/apps/bun-create-next.sh
test-dev-create-react:
BUN_BIN=$(DEBUG_BUN) bash integration/apps/bun-create-react.sh
test-create-next:
BUN_BIN=$(RELEASE_BUN) bash integration/apps/bun-create-next.sh
test-bun-run:
cd integration/apps && BUN_BIN=$(RELEASE_BUN) bash ./bun-run-check.sh
test-create-react:
BUN_BIN=$(RELEASE_BUN) bash integration/apps/bun-create-react.sh
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-bun-run:
cd integration/apps && BUN_BIN=$(DEBUG_BUN) bash bun-run-check.sh
test-dev-all: test-dev-with-hmr test-dev-no-hmr test-dev-create-next test-dev-create-react test-dev-bun-run
test-dev-bunjs:
test-dev: test-dev-with-hmr
jsc-copy-headers:
find $(WEBKIT_RELEASE_DIR)/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} $(WEBKIT_RELEASE_DIR)/JavaScriptCore/PrivateHeaders/JavaScriptCore/ \;
jsc-build-mac-compile:
cd $(WEBKIT_DIR) && ICU_INCLUDE_DIRS="$(HOMEBREW_PREFIX)opt/icu4c/include" ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo -DUSE_PTHREAD_JIT_PERMISSIONS_API=ON $(CMAKE_FLAGS_WITHOUT_RELEASE)"
jsc-build-linux-compile-config:
mkdir -p $(WEBKIT_RELEASE_DIR)
cd $(WEBKIT_RELEASE_DIR) && \
cmake \
-DPORT="JSCOnly" \
-DENABLE_STATIC_JSC=ON \
-DCMAKE_BUILD_TYPE=relwithdebuginfo \
-DUSE_THIN_ARCHIVES=OFF \
-DENABLE_FTL_JIT=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-G Ninja \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DCMAKE_C_COMPILER=$(CC) \
$(WEBKIT_DIR) \
$(WEBKIT_RELEASE_DIR)
# If you get "Error: could not load cache"
# run rm -rf src/javascript/jsc/WebKit/CMakeCache.txt
jsc-build-linux-compile-build:
mkdir -p $(WEBKIT_RELEASE_DIR) && \
cd $(WEBKIT_RELEASE_DIR) && \
CFLAGS="$CFLAGS -ffat-lto-objects" CXXFLAGS="$CXXFLAGS -ffat-lto-objects" \
cmake --build $(WEBKIT_RELEASE_DIR) --config relwithdebuginfo --target jsc
jsc-build-mac: jsc-build-mac-compile jsc-build-mac-copy
jsc-build-linux: jsc-build-linux-compile-config jsc-build-linux-compile-build jsc-build-mac-copy
jsc-build-mac-copy:
cp $(WEBKIT_RELEASE_DIR)/lib/libJavaScriptCore.a $(BUN_DEPS_OUT_DIR)/libJavaScriptCore.a
cp $(WEBKIT_RELEASE_DIR)/lib/libWTF.a $(BUN_DEPS_OUT_DIR)/libWTF.a
cp $(WEBKIT_RELEASE_DIR)/lib/libbmalloc.a $(BUN_DEPS_OUT_DIR)/libbmalloc.a
clean-bindings:
rm -rf $(OBJ_DIR)/*.o
clean: clean-bindings
rm $(BUN_DEPS_DIR)/*.a $(BUN_DEPS_DIR)/*.o
(cd $(BUN_DEPS_DIR)/mimalloc && make clean) || echo "";
(cd $(BUN_DEPS_DIR)/libarchive && make clean) || echo "";
(cd $(BUN_DEPS_DIR)/boringssl && make clean) || echo "";
(cd $(BUN_DEPS_DIR)/picohttp && make clean) || echo "";
(cd $(BUN_DEPS_DIR)/zlib && make clean) || echo "";
jsc-bindings-mac: $(OBJ_FILES)
# mimalloc is built as object files so that it can overload the system malloc
mimalloc:
cd $(BUN_DEPS_DIR)/mimalloc; cmake $(CMAKE_FLAGS) -DMI_BUILD_SHARED=OFF -DMI_BUILD_STATIC=ON -DMI_BUILD_TESTS=OFF -DMI_BUILD_OBJECT=ON ${MIMALLOC_OVERRIDE_FLAG} -DMI_USE_CXX=ON .; make;
cp $(BUN_DEPS_DIR)/mimalloc/$(MIMALLOC_INPUT_PATH) $(BUN_DEPS_OUT_DIR)/$(MIMALLOC_FILE)
bun-link-lld-debug:
$(CXX) $(BUN_LLD_FLAGS) \
-g \
$(DEBUG_BIN)/bun-debug.o \
-W \
-o $(DEBUG_BIN)/bun-debug \
bun-relink-copy:
cp /tmp/bun-$(PACKAGE_JSON_VERSION).o $(BUN_RELEASE_BIN).o
bun-relink: bun-relink-copy bun-link-lld-release
bun-link-lld-release:
$(CXX) $(BUN_LLD_FLAGS) \
$(BUN_RELEASE_BIN).o \
-o $(BUN_RELEASE_BIN) \
-W \
-flto \
-ftls-model=initial-exec \
-O3
cp $(BUN_RELEASE_BIN) $(BUN_RELEASE_BIN)-profile
-$(STRIP) $(BUN_RELEASE_BIN)
mv $(BUN_RELEASE_BIN).o /tmp/bun-$(PACKAGE_JSON_VERSION).o
# 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) \
-O3 \
-w
sizegen:
$(CXX) src/javascript/jsc/headergen/sizegen.cpp -o $(BUN_TMP_DIR)/sizegen $(CLANG_FLAGS) -O1
$(BUN_TMP_DIR)/sizegen > src/javascript/jsc/bindings/sizes.zig
picohttp:
$(CC) $(MARCH_NATIVE) $(MACOS_MIN_FLAG) -O3 -g -fPIE -c $(BUN_DEPS_DIR)/picohttpparser/picohttpparser.c -I$(BUN_DEPS_DIR) -o $(BUN_DEPS_OUT_DIR)/picohttpparser.o; cd ../../
analytics:
./node_modules/.bin/peechy --schema src/analytics/schema.peechy --zig src/analytics/analytics_schema.zig
$(ZIG) fmt src/analytics/analytics_schema.zig
analytics-features:
@cd misctools; $(ZIG) run --main-pkg-path ../ ./features.zig
find-unused-zig-files:
@bash ./misctools/find-unused-zig.sh
generate-unit-tests:
@bash ./misctools/generate-test-file.sh
fmt-all:
find src -name "*.zig" -exec $(ZIG) fmt {} \;
unit-tests: generate-unit-tests run-unit-tests
ifeq (test, $(firstword $(MAKECMDGOALS)))
testpath := $(firstword $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS)))
testfilter := $(wordlist 3, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
testbinpath := zig-out/bin/test
testbinpath := $(lastword $(testfilter))
ifeq ($(if $(patsubst /%,,$(testbinpath)),,yes),yes)
testfilterflag := --test-filter "$(filter-out $(testbinpath), $(testfilter))"
endif
ifneq ($(if $(patsubst /%,,$(testbinpath)),,yes),yes)
testbinpath := zig-out/bin/test
ifneq ($(strip $(testfilter)),)
testfilterflag := --test-filter "$(testfilter)"
endif
endif
testname := $(shell basename $(testpath))
$(eval $(testname):;@true)
ifeq ($(words $(testfilter)), 0)
testfilterflag := --test-name-prefix "$(testname): "
endif
ifeq ($(testfilterflag), undefined)
testfilterflag := --test-name-prefix "$(testname): "
endif
endif
ifeq (build-unit, $(firstword $(MAKECMDGOALS)))
testpath := $(firstword $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS)))
testfilter := $(wordlist 3, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
testbinpath := zig-out/bin/test
testbinpath := $(lastword $(testfilter))
ifeq ($(if $(patsubst /%,,$(testbinpath)),,yes),yes)
testfilterflag := --test-filter "$(filter-out $(testbinpath), $(testfilter))"
endif
ifneq ($(if $(patsubst /%,,$(testbinpath)),,yes),yes)
testbinpath := zig-out/bin/test
ifneq ($(strip $(testfilter)),)
testfilterflag := --test-filter "$(testfilter)"
endif
endif
testname := $(shell basename $(testpath))
$(eval $(testname):;@true)
$(eval $(testfilter):;@true)
$(eval $(testpath):;@true)
ifeq ($(words $(testfilter)), 0)
testfilterflag := --test-name-prefix "$(testname): "
endif
ifeq ($(testfilterflag), undefined)
testfilterflag := --test-name-prefix "$(testname): "
endif
endif
build-unit:
@rm -rf zig-out/bin/$(testname)
@mkdir -p zig-out/bin
zig test $(realpath $(testpath)) \
$(testfilterflag) \
$(PACKAGE_MAP) \
--main-pkg-path $(BUN_DIR) \
--test-no-exec \
-fPIC \
-femit-bin=zig-out/bin/$(testname) \
-fcompiler-rt \
-lc -lc++ \
--cache-dir /tmp/zig-cache-bun-$(testname)-$(basename $(lastword $(testfilter))) \
-fallow-shlib-undefined \
$(ARCHIVE_FILES) $(ICU_FLAGS) && \
cp zig-out/bin/$(testname) $(testbinpath)
run-all-unit-tests:
@rm -rf zig-out/bin/__main_test
@mkdir -p zig-out/bin
zig test src/main.zig \
$(PACKAGE_MAP) \
--main-pkg-path $(BUN_DIR) \
--test-no-exec \
-fPIC \
-femit-bin=zig-out/bin/__main_test \
-fcompiler-rt \
-lc -lc++ \
--cache-dir /tmp/zig-cache-bun-__main_test \
-fallow-shlib-undefined \
$(ARCHIVE_FILES) $(ICU_FLAGS) $(JSC_FILES) $(OBJ_FILES) && \
zig-out/bin/__main_test notARealParam
run-unit:
@zig-out/bin/$(testname) -- fake
test: build-unit run-unit
integration-test-dev:
USE_EXISTING_PROCESS=true TEST_SERVER_URL=http://localhost:3000 node integration/scripts/browser.js
copy-install:
cp src/cli/install.sh ../bun.sh/docs/install.html
copy-to-bun-release-dir:
cp -r $(PACKAGE_DIR)/bun $(BUN_RELEASE_DIR)/bun
cp -r $(PACKAGE_DIR)/bun-profile $(BUN_RELEASE_DIR)/bun-profile
PACKAGE_MAP = --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin clap $(BUN_DIR)/src/deps/zig-clap/clap.zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-end --pkg-begin strings $(BUN_DIR)/src/string_immutable.zig --pkg-end --pkg-begin boringssl $(BUN_DIR)/src/deps/boringssl.zig --pkg-end --pkg-begin picohttp $(BUN_DIR)/src/deps/picohttp.zig --pkg-end --pkg-end --pkg-begin network_thread $(BUN_DIR)/src/http/network_thread.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin thread_pool $(BUN_DIR)/src/thread_pool.zig --pkg-begin io $(BUN_DIR)/src/io/io_$(OS_NAME).zig --pkg-end --pkg-begin http $(BUN_DIR)/src/http_client_async.zig --pkg-end --pkg-end --pkg-end

1275
README.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
bun
next
src/*.mov
src/*.blob

View File

@@ -0,0 +1,77 @@
SLEEP_INTERVAL ?= 32
SCREEN_WIDTH ?= $(shell system_profiler -json SPDisplaysDataType 2>/dev/null | jq -r '.. | objects | select(.spdisplays_main) | ._spdisplays_pixels | split(" ")[0]')
SCREEN_HEIGHT ?= $(shell system_profiler -json SPDisplaysDataType 2>/dev/null | jq -r '.. | objects | select(.spdisplays_main) | ._spdisplays_pixels | split(" ")[2]')
PROJECT ?= bun
PACKAGE_NAME ?= bun-cli
RUN_COUNT ?= 128
ENDPOINT ?= /
ifeq ($(PROJECT),bun)
PACKAGE_NAME := bun-cli
endif
ifeq ($(PROJECT),next)
PACKAGE_NAME := next
endif
generate:
@killall -9 bun next node || echo ""
PROJECT=$(PROJECT) SCREEN_WIDTH=$(SCREEN_WIDTH) SCREEN_HEIGHT=$(SCREEN_HEIGHT) ENDPOINT=$(ENDPOINT) node browser.js
generate-css-in-js:
@killall -9 bun next node || echo ""
PROJECT=$(PROJECT) SCREEN_WIDTH=$(SCREEN_WIDTH) SCREEN_HEIGHT=$(SCREEN_HEIGHT) ENDPOINT=/css-in-js node browser.js
loop:
cp src/colors.css.0 src/colors.css
sleep 3
osascript -e 'tell application "System Events" to tell process "Chromium"' \
-e 'set frontmost to true' \
-e 'if windows is not {} then perform action "AXRaise" of item 1 of windows' \
-e 'end tell'
sleep 0.5
cd src; zig run -Drelease-fast ../color-looper.zig -- ./colors.css:0 $(SLEEP_INTERVAL)
cp src/colors.css.blob $(PROJECT)/colors.css.blob
loop-emotion:
cp src/css-in-js-styles.0 src/css-in-js-styles.tsx
sleep 3
osascript -e 'tell application "System Events" to tell process "Chromium"' \
-e 'set frontmost to true' \
-e 'if windows is not {} then perform action "AXRaise" of item 1 of windows' \
-e 'end tell'
sleep 0.5
cd src; zig run -Drelease-fast ../color-looper.emotion.zig -- ./css-in-js-styles.tsx:0 $(SLEEP_INTERVAL)
cp src/css-in-js-styles.tsx.blob $(PROJECT)/css-in-js-styles.blob
process_video:
rm -rf $(FRAMES_DIR); mkdir -p $(FRAMES_DIR); ffmpeg -i src/colors.css.mov -vf fps=120,format=gray $(FRAMES_DIR)/%d.tif
FRAMES_DIR ?= $(shell mkdir -p ./$(PROJECT)/frames; realpath ./$(PROJECT)/frames)
TIF_FILES := $(wildcard $(FRAMES_DIR)/*.tif)
TXT_FILES := $(wildcard $(FRAMES_DIR)/*.txt)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.tif,$(OBJ_DIR)/%.txt,$(TIF_FILES))
TRIM_FILES := $(patsubst $(SRC_DIR)/%.txt,$(OBJ_DIR)/%.trim,$(TXT_FILES))
frames: $(OBJ_FILES)
$(FRAMES_DIR)/%.txt: $(FRAMES_DIR)/%.tif
tesseract -l eng $< $@
trim: $(TRIM_FILES) cleanup print
$(FRAMES_DIR)/%.trim: $(FRAMES_DIR)/%.txt
(grep "Ran:" $< || echo "\n") >> $(PROJECT)/frames.all
cleanup:
sed 's/^Ran: *//' $(PROJECT)/frames.all | tr -d ' ' | sort | uniq > $(PROJECT)/frames.all.clean
print:
PACKAGE_NAME=$(PACKAGE_NAME) SLEEP_INTERVAL=$(SLEEP_INTERVAL) PROJECT=$(PROJECT) OUTFILE=timings/$(PACKAGE_NAME) node read-frames.js
print-emotion:
PACKAGE_NAME=$(PACKAGE_NAME) SLEEP_INTERVAL=$(SLEEP_INTERVAL) PROJECT=$(PROJECT) OUTFILE=timings/emotion_$(PACKAGE_NAME) node read-frames.js

View File

@@ -0,0 +1,62 @@
# CSS Stress Test
This benchmarks bundler performance for CSS hot reloading.
## Results
Bun is 14x faster than Next.js at hot reloading CSS.
```
Bun v0.0.34
Saving every 16ms
Frame time:
50th percentile: 22.2ms
75th percentile: 23.9ms
90th percentile: 25.3ms
95th percentile: 43.6ms
99th percentile: 49.1ms
Rendered frames: 922 / 1024 (90%)
```
```
Next.js v11.1.2
Saving every 16ms
Frame time:
50th percentile: 312ms
75th percentile: 337.6ms
90th percentile: 387.7ms
95th percentile: 446.9ms
99th percentile: 591.7ms
Rendered frames: 64 / 1024 (6%)
```
## How it works
It times pixels instead of builds. `color-looper.zig` writes color updates and the timestamp to a css file, while simultaneously screen recording a non-headless Chromium instance. After it finishes, it OCRs the video frames and verifies the scanned timestamps against the actual data. This data measures (1) how long each update took from saving to disk up to the pixels visible on the screen and (2) what % of frames were rendered.
The intent is to be as accurate as possible. Measuring times reported client-side is simpler, but lower accuracy since those times may not correspond to pixels on the screen and do not start from when the data was written to disk (at best, they measure when the filesystem watcher detected the update, but often not that either). `color-looper.zig` must run separately from `browser.js` or the results will be innaccurate.
It works like this:
1. `browser.js` loads either Bun or Next.js and a Chromium instance opened to the correct webpage
2. `color-looper.zig` updates [`./src/colors.css`](./src/colors.css) in a loop up to `1024` times (1024 is arbitrary), sleeping every `16`ms or `32`ms (a CLI arg you can pass it). The `var(--timestamp)` CSS variable contains the UTC timestamp with precision of milliseconds and one extra decimal point
3. `color-looper.zig` automatically records the screen via `screencapture` (builtin on macOS) and saves it, along with a `BigUint64Array` containing all the expected timestamps. When it's done, it writes to a designated file on disk which `browser.js` picks up as the signal to close the browser.
4. `ffmpeg` converts each frame into a black and white `.tif` file, which `tesseract` then OCRs
5. Various cleanup scripts extract the timestamp from each of those OCR'd frames into a single file
6. Using the OCR'd data, `./read-frames.js` calculates the 50th, 75th, 90th, 95th, and 99th percentile frame time, along with how many frames were skipped. Frame time is the metric here that matters here because that's how much time elapsed between each update. It includes the artificial sleep interval, so it will not be faster than the sleep interval.
The script `run.sh` runs all the commands necessary to do this work unattended. It takes awhile though. The slow part is OCR'ing all the frames.
To run this, you need:
- `zig`
- `bun-cli`
- `node`
- `tesseract`
- `screencapture` (macOS builtin)
- `ffmpeg`
- `puppeteer` (from the package.json)
You will need to run `bun bun --use next` first, with `next@11.1.2`. It will only run on macOS due to the dependencies on `screencapture`, how it detects screen resolution (so that Chromium is maximized), and how it auto-focuses Chromium (apple script)

View File

@@ -0,0 +1,118 @@
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 serverURL = process.env.TEST_SERVER_URL || "http://localhost:8080";
if (process.env.PROJECT === "bun") {
const bunFlags = [`--origin=${serverURL}`].filter(Boolean);
const bunExec = process.env.BUN_BIN || "bun";
const bunProcess = child_process.spawn(bunExec, bunFlags, {
cwd: process.cwd(),
stdio: "ignore",
env: {
...process.env,
DISABLE_BUN_ANALYTICS: "1",
},
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);
});
} else if (process.env.PROJECT === "next") {
const bunProcess = child_process.spawn(
"./node_modules/.bin/next",
["--port", "8080"],
{
cwd: process.cwd(),
stdio: "ignore",
env: {
...process.env,
},
shell: false,
}
);
}
const delay = new Promise((resolve, reject) => {
const watcher = fs.watch(path.resolve(process.cwd(), "src/colors.css.blob"));
watcher.once("change", () => {
setTimeout(() => {
resolve();
}, 1000);
});
});
async function main() {
const browser = await puppeteer.launch({
headless: false,
waitForInitialPage: true,
args: [
`--window-size=${parseInt(process.env.SCREEN_WIDTH || "1024", 10) / 2},${
parseInt(process.env.SCREEN_HEIGHT || "1024", 10) / 2
}`,
],
defaultViewport: {
width: parseInt(process.env.SCREEN_WIDTH || "1024", 10) / 2,
height: parseInt(process.env.SCREEN_HEIGHT || "1024", 10) / 2,
},
});
const promises = [];
let allTestsPassed = true;
async function runPage(key) {
var page;
try {
console.log("Opening page");
page = await browser.newPage();
console.log(`Navigating to "http://localhost:8080/"`);
while (true) {
try {
await page.goto("http://localhost:8080/", { waitUntil: "load" });
break;
} catch (exception) {
if (!exception.toString().includes("ERR_CONNECTION_REFUSED")) break;
}
}
await page.bringToFront();
await delay;
// runner.stdout.pipe(process.stdout);
// runner.stderr.pipe(process.stderr);
var didResolve = false;
console.log(`Completed. Done.`);
} catch (error) {
console.error(error);
} finally {
await page.close();
await browser.close();
}
}
return runPage();
}
main().catch((error) =>
setTimeout(() => {
throw error;
})
);

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=16 PROJECT=bun node read-frames.js
bun
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 22.2ms
75th percentile: 23.9ms
90th percentile: 25.3ms
95th percentile: 43.6ms
99th percentile: 49.1ms
Rendered frames: 922 / 1024 (90%)

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=24 PROJECT=bun node read-frames.js
bun
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 33.4ms
75th percentile: 34.5ms
90th percentile: 35.8ms
95th percentile: 65.5ms
99th percentile: 87.9ms
Rendered frames: 937 / 1024 (92%)

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=32 PROJECT=bun node read-frames.js
bun
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 40.7ms
75th percentile: 42.3ms
90th percentile: 43.5ms
95th percentile: 76.4ms
99th percentile: 118.8ms
Rendered frames: 958 / 1024 (94%)

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=8 PROJECT=bun node read-frames.js
bun
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 20ms
75th percentile: 24.4ms
90th percentile: 41ms
95th percentile: 53.9ms
99th percentile: 90.4ms
Rendered frames: 475 / 1024 (46%)

View File

@@ -0,0 +1,218 @@
const std = @import("std");
pub const Counter = extern struct {
timestamp: usize,
percent: f64,
rotate: u32,
color_values: [8 * 3]u32,
};
const RUN_COUNT = 1024;
var counters: [RUN_COUNT]Counter = undefined;
pub const Blob = extern struct {
run_count: u32,
interval: u64,
};
pub var all_timestamps: [RUN_COUNT + 1]usize = undefined;
// usage:
// ./file-path:0 10
// 1 2 3
// 1. file path
// 2. Byte offset in file
// 3. ms update interval
var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined;
pub fn main() anyerror!void {
var allocator = std.heap.c_allocator;
var timer = try std.time.Timer.start();
var args = std.mem.span(try std.process.argsAlloc(allocator));
var basepath_with_colon: []u8 = args[args.len - 2];
var basepath: []u8 = "";
var position_str: []u8 = "";
if (std.mem.lastIndexOfScalar(u8, basepath_with_colon, ':')) |colon| {
basepath = basepath_with_colon[0..colon];
position_str = basepath_with_colon[colon + 1 ..];
}
var position = try std.fmt.parseInt(u32, position_str, 10);
const filepath = try std.fs.path.resolve(allocator, &.{basepath});
var file = try std.fs.openFileAbsolute(filepath, .{ .write = true });
var ms = @truncate(u64, (try std.fmt.parseInt(u128, args[args.len - 1], 10)) * std.time.ns_per_ms);
std.debug.assert(ms > 0);
// std.debug.assert(std.math.isFinite(position));
var prng = std.rand.DefaultPrng.init(0);
var stdout = std.io.getStdOut();
var log = stdout.writer();
var colors = std.mem.zeroes([4][3]u32);
var progress_bar: f64 = 0.0;
var destination_count: f64 = 18.0;
// Randomize initial colors
colors[0][0] = prng.random.int(u32);
colors[0][1] = prng.random.int(u32);
colors[0][2] = prng.random.int(u32);
colors[1][0] = prng.random.int(u32);
colors[1][1] = prng.random.int(u32);
colors[1][2] = prng.random.int(u32);
colors[2][0] = prng.random.int(u32);
colors[2][1] = prng.random.int(u32);
colors[2][2] = prng.random.int(u32);
colors[3][0] = prng.random.int(u32);
colors[3][1] = prng.random.int(u32);
colors[3][2] = prng.random.int(u32);
var rotate: u32 = 0;
var counter: usize = 0;
const video = std.fmt.allocPrint(allocator, "{s}.mov", .{filepath}) catch unreachable;
std.fs.deleteFileAbsolute(video) catch {};
var screen_recorder_argv = [_][]const u8{ "screencapture", "-v", video };
var recorder = try std.ChildProcess.init(&screen_recorder_argv, allocator);
recorder.stdin_behavior = .Pipe;
try recorder.spawn();
std.time.sleep(std.time.ns_per_s);
var wrote: []u8 = undefined;
while (counter < RUN_COUNT) {
colors[0][0] += 1;
colors[0][1] += 1;
colors[0][2] += 1;
colors[1][0] += 1;
colors[1][1] += 1;
colors[1][2] += 1;
colors[2][0] += 1;
colors[2][1] += 1;
colors[2][2] += 1;
colors[3][0] += 1;
colors[3][1] += 1;
colors[3][2] += 1;
rotate += 1;
const fmtd: []const u8 = comptime brk: {
break :brk (
\\
\\import {{ Global }} from "@emotion/react";
\\export function CSSInJSStyles() {{
\\ return (
\\ <Global
\\ styles={{`
\\:root {{
\\ --timestamp: "{d}";
\\ --interval: "{s}";
\\ --progress-bar: {d}%;
\\ --spinner-1-muted: rgb({d}, {d}, {d});
\\ --spinner-1-primary: rgb({d}, {d}, {d});
\\ --spinner-2-muted: rgb({d}, {d}, {d});
\\ --spinner-2-primary: rgb({d}, {d}, {d});
\\ --spinner-3-muted: rgb({d}, {d}, {d});
\\ --spinner-3-primary: rgb({d}, {d}, {d});
\\ --spinner-4-muted: rgb({d}, {d}, {d});
\\ --spinner-4-primary: rgb({d}, {d}, {d});
\\ --spinner-rotate: {d}deg;
\\}}
++ SIMULATE_LONG_FILE ++
\\ `}}
\\ />
\\ );
\\}}
\\
);
};
counters[counter].timestamp = @truncate(u64, @intCast(u128, std.time.nanoTimestamp()) / (std.time.ns_per_ms / 10));
counters[counter].rotate = rotate % 360;
counters[counter].percent = std.math.mod(f64, std.math.round(((progress_bar + 1.0) / destination_count) * 1000) / 1000, 100) catch 0;
counters[counter].color_values[0] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[0][0] + 1) % 256)) * 0.8));
counters[counter].color_values[1] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[0][1] + 1) % 256)) * 0.8));
counters[counter].color_values[2] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[0][2] + 1) % 256)) * 0.8));
counters[counter].color_values[3] = (colors[0][0] + 1) % 256;
counters[counter].color_values[4] = (colors[0][1] + 1) % 256;
counters[counter].color_values[5] = (colors[0][2] + 1) % 256;
counters[counter].color_values[6] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[1][0] + 1) % 256)) * 0.8));
counters[counter].color_values[7] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[1][1] + 1) % 256)) * 0.8));
counters[counter].color_values[8] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[1][2] + 1) % 256)) * 0.8));
counters[counter].color_values[9] = (colors[1][0] + 1) % 256;
counters[counter].color_values[10] = (colors[1][1] + 1) % 256;
counters[counter].color_values[11] = (colors[1][2] + 1) % 256;
counters[counter].color_values[12] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[2][0] + 1) % 256)) * 0.8));
counters[counter].color_values[13] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[2][1] + 1) % 256)) * 0.8));
counters[counter].color_values[14] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[2][2] + 1) % 256)) * 0.8));
counters[counter].color_values[15] = (colors[2][0] + 1) % 256;
counters[counter].color_values[16] = (colors[2][1] + 1) % 256;
counters[counter].color_values[17] = (colors[2][2] + 1) % 256;
counters[counter].color_values[18] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[3][0] + 1) % 256)) * 0.8));
counters[counter].color_values[19] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[3][1] + 1) % 256)) * 0.8));
counters[counter].color_values[20] = @floatToInt(u32, std.math.round(@intToFloat(f64, ((colors[3][2] + 1) % 256)) * 0.8));
counters[counter].color_values[21] = (colors[3][0] + 1) % 256;
counters[counter].color_values[22] = (colors[3][1] + 1) % 256;
counters[counter].color_values[23] = (colors[3][2] + 1) % 256;
file = try std.fs.createFileAbsolute(filepath, .{ .truncate = true });
wrote = try std.fmt.bufPrint(&color_buf, fmtd, .{
counters[counter].timestamp,
args[args.len - 1],
counters[counter].percent,
counters[counter].color_values[0],
counters[counter].color_values[1],
counters[counter].color_values[2],
counters[counter].color_values[3],
counters[counter].color_values[4],
counters[counter].color_values[5],
counters[counter].color_values[6],
counters[counter].color_values[7],
counters[counter].color_values[8],
counters[counter].color_values[9],
counters[counter].color_values[10],
counters[counter].color_values[11],
counters[counter].color_values[12],
counters[counter].color_values[13],
counters[counter].color_values[14],
counters[counter].color_values[15],
counters[counter].color_values[16],
counters[counter].color_values[17],
counters[counter].color_values[18],
counters[counter].color_values[19],
counters[counter].color_values[20],
counters[counter].color_values[21],
counters[counter].color_values[22],
counters[counter].color_values[23],
counters[counter].rotate,
});
progress_bar += 1.0;
_ = try file.writeAll(wrote);
try log.print("[{d}] \"{s}\":{d}\n", .{
std.time.nanoTimestamp(),
filepath,
position,
});
counter += 1;
// If we don't close the file, Parcel seems to never recognize it
file.close();
std.time.sleep(ms);
}
try recorder.stdin.?.writeAll(&[_]u8{ 3, ';' });
_ = try recorder.wait();
all_timestamps[0] = wrote.len;
for (counters) |count, i| {
all_timestamps[i + 1] = count.timestamp;
}
std.time.sleep(std.time.ns_per_s);
var blob_file = try std.fs.createFileAbsolute(std.fmt.allocPrint(std.heap.c_allocator, "{s}.blob", .{filepath}) catch unreachable, .{ .truncate = true });
try blob_file.writeAll(std.mem.asBytes(&all_timestamps));
blob_file.close();
}
const SIMULATE_LONG_FILE =
\\
;

File diff suppressed because it is too large Load Diff

View 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>

View File

@@ -0,0 +1,2 @@
import React from "react";
export { React };

View 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.

View File

@@ -0,0 +1,5 @@
module.exports = {
experimental: {
swcLoader: true,
},
};

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=16 PROJECT=next node read-frames.js
next
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 312ms
75th percentile: 337.6ms
90th percentile: 387.7ms
95th percentile: 446.9ms
99th percentile: 591.7ms
Rendered frames: 64 / 1024 (6%)

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=24 PROJECT=next node read-frames.js
next
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 310.1ms
75th percentile: 360.3ms
90th percentile: 461.6ms
95th percentile: 660.4ms
99th percentile: 1009.9ms
Rendered frames: 78 / 1024 (8%)

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=32 PROJECT=next node read-frames.js
next
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 306.7ms
75th percentile: 324.7ms
90th percentile: 380ms
95th percentile: 483.6ms
99th percentile: 933.6ms
Rendered frames: 116 / 1024 (11%)

View File

@@ -0,0 +1,11 @@
SLEEP_INTERVAL=8 PROJECT=next node read-frames.js
next
--------------------------------------------------
CSS HMR FRAME TIME
50th percentile: 320.4ms
75th percentile: 368.8ms
90th percentile: 527.2ms
95th percentile: 532.4ms
99th percentile: 532.4ms
Rendered frames: 32 / 1024 (3%)

View File

@@ -0,0 +1,43 @@
{
"name": "simple-react",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@emotion/core": "latest",
"@emotion/css": "latest",
"@emotion/react": "latest",
"@vitejs/plugin-react-refresh": "^1.3.3",
"antd": "^4.16.1",
"bun-framework-next": "latest",
"left-pad": "^1.3.0",
"next": "^12",
"parcel": "2.0.0-beta.3",
"path-browserify": "^1.0.1",
"percentile": "^1.5.0",
"puppeteer": "^10.4.0",
"puppeteer-video-recorder": "^1.0.5",
"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"
}
}

View 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;

View File

@@ -0,0 +1,12 @@
import { Main } from "src/main";
export function IndexPage() {
return (
<Main
productName={
typeof location !== "undefined" ? location.search.substring(1) : ""
}
/>
);
}
export default IndexPage;

View File

@@ -0,0 +1 @@
export { default as React } from "react";

View File

@@ -0,0 +1,107 @@
const fs = require("fs");
const path = require("path");
const PROJECT = process.env.PROJECT || "bun";
const percentile = require("percentile");
const PACKAGE_NAME = process.env.PACKAGE_NAME;
const label = `${PACKAGE_NAME}@${
require(PACKAGE_NAME + "/package.json").version
}`;
const BASEFOLDER = path.resolve(PROJECT);
const OUTFILE = path.join(process.cwd(), process.env.OUTFILE);
const buf = fs.readFileSync(BASEFOLDER + "/colors.css.blob");
const VALID_TIMES = new BigUint64Array(buf.buffer).subarray(1);
const cssFileSize = new BigUint64Array(buf.buffer)[0];
const TOTAL_FRAMES = VALID_TIMES.length;
const timings = fs
.readFileSync(BASEFOLDER + "/frames.all.clean", "utf8")
.split("\n")
.map((a) => a.replace(/[Ran:'\.]?/gm, "").trim())
.filter((a) => parseInt(a, 10))
.filter((a) => a.length > 0 && VALID_TIMES.includes(BigInt(parseInt(a, 10))))
.map((num) => BigInt(num));
timings.sort();
const frameTimesCount = timings.length;
var frameTime = new Array(Math.floor(frameTimesCount / 2));
for (let i = 0; i < frameTime.length; i++) {
const i1 = i * 2;
const i2 = i * 2 + 1;
frameTime[i] = Math.max(Number(timings[i2] - timings[i1]), 0);
}
const report = {
label,
cssFileSize: Number(cssFileSize),
at: new Date().toISOString(),
sleep: process.env.SLEEP_INTERVAL,
package: {
name: PACKAGE_NAME,
version: require(PACKAGE_NAME + "/package.json").version,
},
timestamps: timings.map((a) => Number(a)),
frameTimes: frameTime,
percentileMs: {
50: percentile(50, frameTime) / 10,
75: percentile(75, frameTime) / 10,
90: percentile(90, frameTime) / 10,
95: percentile(95, frameTime) / 10,
99: percentile(99, frameTime) / 10,
},
};
fs.writeFileSync(
path.join(
path.dirname(OUTFILE),
path.basename(OUTFILE) +
"@" +
report.package.version +
"." +
process.env.SLEEP_INTERVAL +
"ms." +
`${process.platform}-${
process.arch === "arm64" ? "aarch64" : process.arch
}` +
".json"
),
JSON.stringify(report, null, 2)
);
console.log(
label + "\n",
"-".repeat(50) + "\n",
"CSS HMR FRAME TIME\n" + "\n",
"50th percentile:",
percentile(50, frameTime) / 10 + "ms",
"\n",
"75th percentile:",
percentile(75, frameTime) / 10 + "ms",
"\n",
"90th percentile:",
percentile(90, frameTime) / 10 + "ms",
"\n",
"95th percentile:",
percentile(95, frameTime) / 10 + "ms",
"\n",
"99th percentile:",
percentile(99, frameTime) / 10 + "ms",
"\n",
"Rendered frames:",
timings.length,
"/",
TOTAL_FRAMES,
"(" +
Math.round(
Math.max(Math.min(1.0, timings.length / TOTAL_FRAMES), 0) * 100
) +
"%)"
);

View File

@@ -0,0 +1,83 @@
#!/bin/bash
echo "Running next at 24ms"
PROJECT=next SLEEP_INTERVAL=24 make generate &
PROJECT=next SLEEP_INTERVAL=24 make loop
killall Chromium || echo "";
PROJECT=next SLEEP_INTERVAL=24 make process_video
PROJECT=next SLEEP_INTERVAL=24 make frames -j$(nproc)
PROJECT=next SLEEP_INTERVAL=24 make trim
cp src/colors.css.blob next/colors.css.blob
PROJECT=next SLEEP_INTERVAL=24 make print > "next.latest.24ms.txt"
echo "Running bun at 24ms"
PROJECT=bun SLEEP_INTERVAL=24 make generate &
PROJECT=bun SLEEP_INTERVAL=24 make loop
killall Chromium || echo "";
PROJECT=bun SLEEP_INTERVAL=24 make process_video
PROJECT=bun SLEEP_INTERVAL=24 make frames -j$(nproc)
PROJECT=bun SLEEP_INTERVAL=24 make trim
cp src/colors.css.blob bun/colors.css.blob
PROJECT=bun SLEEP_INTERVAL=24 make print > "bun.latest.24ms.txt"
echo "Running next at 16ms"
PROJECT=next SLEEP_INTERVAL=16 make generate &
PROJECT=next SLEEP_INTERVAL=16 make loop
killall Chromium || echo "";
PROJECT=next SLEEP_INTERVAL=16 make process_video
PROJECT=next SLEEP_INTERVAL=16 make frames -j$(nproc)
PROJECT=next SLEEP_INTERVAL=16 make trim
cp src/colors.css.blob next/colors.css.blob
PROJECT=next SLEEP_INTERVAL=16 make print > "next.latest.16ms.txt"
echo "Running bun at 16ms"
PROJECT=bun SLEEP_INTERVAL=16 make generate &
PROJECT=bun SLEEP_INTERVAL=16 make loop
killall Chromium || echo "";
PROJECT=bun SLEEP_INTERVAL=16 make process_video
PROJECT=bun SLEEP_INTERVAL=16 make frames -j$(nproc)
PROJECT=bun SLEEP_INTERVAL=16 make trim
cp src/colors.css.blob bun/colors.css.blob
PROJECT=bun SLEEP_INTERVAL=16 make print > "bun.latest.16ms.txt"
echo "Running bun at 8ms"
PROJECT=bun SLEEP_INTERVAL=8 make generate &
PROJECT=bun SLEEP_INTERVAL=8 make loop
killall Chromium || echo "";
PROJECT=bun SLEEP_INTERVAL=8 make process_video
PROJECT=bun SLEEP_INTERVAL=8 make frames -j$(nproc)
PROJECT=bun SLEEP_INTERVAL=8 make trim
cp src/colors.css.blob bun/colors.css.blob
PROJECT=bun SLEEP_INTERVAL=8 make print > "bun.latest.8ms.txt"
echo "Running next at 8ms"
PROJECT=next SLEEP_INTERVAL=8 make generate &
PROJECT=next SLEEP_INTERVAL=8 make loop
killall Chromium || echo "";
PROJECT=next SLEEP_INTERVAL=8 make process_video
PROJECT=next SLEEP_INTERVAL=8 make frames -j$(nproc)
PROJECT=next SLEEP_INTERVAL=8 make trim
cp src/colors.css.blob next/colors.css.blob
PROJECT=next SLEEP_INTERVAL=8 make print > "next.latest.8ms.txt"
echo "Running bun at 32ms"
PROJECT=bun SLEEP_INTERVAL=32 make generate &
PROJECT=bun SLEEP_INTERVAL=32 make loop
killall Chromium || echo "";
PROJECT=bun SLEEP_INTERVAL=32 make process_video
PROJECT=bun SLEEP_INTERVAL=32 make frames -j$(nproc)
PROJECT=bun SLEEP_INTERVAL=32 make trim
cp src/colors.css.blob bun/colors.css.blob
PROJECT=bun SLEEP_INTERVAL=32 make print > "bun.latest.32ms.txt"
echo "Running next at 32ms"
PROJECT=next SLEEP_INTERVAL=32 make generate &
PROJECT=next SLEEP_INTERVAL=32 make loop
killall Chromium || echo "";
PROJECT=next SLEEP_INTERVAL=32 make process_video
PROJECT=next SLEEP_INTERVAL=32 make frames -j$(nproc)
PROJECT=next SLEEP_INTERVAL=32 make trim
cp src/colors.css.blob next/colors.css.blob
PROJECT=next SLEEP_INTERVAL=32 make print > "next.latest.32ms.txt"

View File

@@ -0,0 +1,14 @@
:root {
--timestamp: "0";
--interval: "8";
--progress-bar: 0%;
--spinner-1-muted: rgb(179, 6, 202);
--spinner-1-primary: rgb(224, 8, 253);
--spinner-2-muted: rgb(22, 188, 124);
--spinner-2-primary: rgb(27, 235, 155);
--spinner-3-muted: rgb(89, 72, 0);
--spinner-3-primary: rgb(111, 90, 0);
--spinner-4-muted: rgb(18, 84, 202);
--spinner-4-primary: rgb(23, 105, 253);
--spinner-rotate: 304deg;
}

View File

@@ -0,0 +1,23 @@
import { Global } from "@emotion/react";
export function CSSInJSStyles() {
return (
<Global
styles={`
:root {
--timestamp: "0";
--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;
}
`}
/>
);
}

View File

@@ -0,0 +1,23 @@
import { Global } from "@emotion/react";
export function CSSInJSStyles() {
return (
<Global
styles={`
:root {
--timestamp: "16336621338281";
--interval: "16";
--progress-bar: 56.889%;
--spinner-1-muted: rgb(179, 6, 202);
--spinner-1-primary: rgb(224, 8, 253);
--spinner-2-muted: rgb(22, 188, 124);
--spinner-2-primary: rgb(27, 235, 155);
--spinner-3-muted: rgb(89, 72, 0);
--spinner-3-primary: rgb(111, 90, 0);
--spinner-4-muted: rgb(18, 84, 202);
--spinner-4-primary: rgb(23, 105, 253);
--spinner-rotate: 304deg;
} `}
/>
);
}

View File

@@ -0,0 +1,248 @@
@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;
}
.ran,
.timer {
white-space: nowrap;
font-weight: bold;
-webkit-text-stroke: white;
-webkit-text-stroke-width: 2px;
color: white;
font-size: 100px;
}
.ran {
}
.ProgressBar-container {
width: 100%;
display: block;
position: relative;
border-left: 10px solid red;
border-right: 10px solid pink;
border-top: 10px solid yellow;
border-bottom: 10px solid orange;
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);
}

View 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} />;
};
function startReact() {
ReactDOM.hydrate(<Base />, document.querySelector("#reactroot"));
}
if (typeof window !== "undefined") {
globalThis.addEventListener("DOMContentLoaded", () => {
startReact();
});
startReact();
}
export { Base };

View File

@@ -0,0 +1,64 @@
export const Main = ({ productName, cssInJS }) => {
return (
<>
<header>
<div className="Title">CSS HMR Stress Test!</div>
<p className="Description">
This page visually tests how quickly a bundler can update{" "}
{cssInJS ? "CSS-in-JS" : "CSS"} over Hot Module Reloading.
</p>
</header>
<main className="main">
<section className="ProgressSection">
<p className="Subtitle">
<span className="Subtitle-part ran">
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 &amp; 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">
{cssInJS ? "CSS-in-JS framework: " + cssInJS : ""}
</div>
</div>
</footer>
</>
);
};

View File

@@ -0,0 +1,292 @@
{
"label": "bun-cli@0.0.34",
"at": "2021-10-08T01:01:18.129Z",
"sleep": "32",
"package": {
"name": "bun-cli",
"version": "0.0.34"
},
"timestamps": [
16336202536562, 16336202536908, 16336202537294, 16336202537705,
16336202538114, 16336202538534, 16336202538941, 16336202539323,
16336202539742, 16336202540159, 16336202540877, 16336202541310,
16336202541749, 16336202542159, 16336202542565, 16336202542996,
16336202543333, 16336202543761, 16336202544159, 16336202544534,
16336202544944, 16336202545345, 16336202545744, 16336202546159,
16336202546573, 16336202546986, 16336202547399, 16336202547781,
16336202548202, 16336202548564, 16336202548949, 16336202549329,
16336202549762, 16336202550168, 16336202550534, 16336202550887,
16336202551305, 16336202551659, 16336202552060, 16336202552449,
16336202552854, 16336202553270, 16336202553609, 16336202554034,
16336202554437, 16336202554783, 16336202555191, 16336202555623,
16336202556034, 16336202556449, 16336202556890, 16336202557283,
16336202557669, 16336202558084, 16336202558496, 16336202558863,
16336202559271, 16336202559659, 16336202560051, 16336202560452,
16336202560873, 16336202561290, 16336202561659, 16336202562035,
16336202562440, 16336202562862, 16336202563284, 16336202563659,
16336202564034, 16336202564444, 16336202564853, 16336202565245,
16336202565659, 16336202566034, 16336202566455, 16336202566873,
16336202567284, 16336202567659, 16336202568034, 16336202568386,
16336202568790, 16336202569204, 16336202569620, 16336202570384,
16336202570768, 16336202571188, 16336202571551, 16336202572327,
16336202572717, 16336202573116, 16336202573541, 16336202573959,
16336202574319, 16336202574682, 16336202575040, 16336202575375,
16336202577001, 16336202577342, 16336202577680, 16336202578066,
16336202578451, 16336202579166, 16336202579534, 16336202579960,
16336202580370, 16336202580789, 16336202581159, 16336202581576,
16336202581949, 16336202582294, 16336202583087, 16336202583496,
16336202583858, 16336202584203, 16336202584606, 16336202585034,
16336202585386, 16336202585788, 16336202586211, 16336202586604,
16336202587034, 16336202587459, 16336202587869, 16336202588295,
16336202588668, 16336202589092, 16336202589452, 16336202589831,
16336202590197, 16336202590608, 16336202591034, 16336202591460,
16336202591880, 16336202592295, 16336202592727, 16336202593172,
16336202593567, 16336202593994, 16336202594397, 16336202594795,
16336202595224, 16336202595659, 16336202596058, 16336202596463,
16336202596890, 16336202597322, 16336202597732, 16336202598159,
16336202598534, 16336202598951, 16336202599365, 16336202599785,
16336202600159, 16336202600593, 16336202601005, 16336202601402,
16336202601807, 16336202602214, 16336202602556, 16336202602895,
16336202603307, 16336202603661, 16336202604075, 16336202604491,
16336202604853, 16336202605268, 16336202605670, 16336202606034,
16336202606393, 16336202606748, 16336202607170, 16336202607568,
16336202607982, 16336202608411, 16336202608836, 16336202609197,
16336202609596, 16336202609965, 16336202610333, 16336202610740,
16336202611159, 16336202611573, 16336202611975, 16336202612317,
16336202612691, 16336202613060, 16336202613474, 16336202613903,
16336202614341, 16336202614707, 16336202615094, 16336202615534,
16336202615883, 16336202616296, 16336202616671, 16336202617034,
16336202617391, 16336202617727, 16336202618159, 16336202618534,
16336202618937, 16336202619360, 16336202619770, 16336202620179,
16336202620716, 16336202621143, 16336202621534, 16336202622303,
16336202622659, 16336202623085, 16336202623498, 16336202623850,
16336202624220, 16336202624606, 16336202625034, 16336202625387,
16336202625805, 16336202626210, 16336202626599, 16336202627034,
16336202627386, 16336202627748, 16336202628159, 16336202628534,
16336202628954, 16336202629373, 16336202629809, 16336202630197,
16336202630535, 16336202630916, 16336202631290, 16336202631666,
16336202632034, 16336202632369, 16336202633152, 16336202633534,
16336202633883, 16336202634309, 16336202634717, 16336202635106,
16336202635871, 16336202636253, 16336202636671, 16336202637070,
16336202637434, 16336202637798, 16336202638184, 16336202638539,
16336202638938, 16336202639307, 16336202639666, 16336202640095,
16336202640534, 16336202640962, 16336202641307, 16336202641659,
16336202642087, 16336202642521, 16336202642886, 16336202643309,
16336202643662, 16336202644067, 16336202644491, 16336202644853,
16336202645226, 16336202645659, 16336202646074, 16336202646497,
16336202646890, 16336202647311, 16336202647749, 16336202648169,
16336202648976, 16336202649378, 16336202649810, 16336202650165,
16336202650534, 16336202650875, 16336202651250, 16336202651659,
16336202652093, 16336202652516, 16336202652921, 16336202653332,
16336202653722, 16336202654142, 16336202654534, 16336202654880,
16336202655221, 16336202655562, 16336202655997, 16336202656378,
16336202656811, 16336202657161, 16336202657588, 16336202657944,
16336202658360, 16336202658708, 16336202659089, 16336202659428,
16336202659849, 16336202660273, 16336202660685, 16336202661105,
16336202661534, 16336202661873, 16336202662228, 16336202662658,
16336202663438, 16336202663843, 16336202664219, 16336202664646,
16336202665050, 16336202665487, 16336202665838, 16336202666211,
16336202666573, 16336202666927, 16336202667334, 16336202667746,
16336202668158, 16336202668563, 16336202668980, 16336202669406,
16336202669753, 16336202670192, 16336202670554, 16336202670903,
16336202671324, 16336202671734, 16336202672159, 16336202672573,
16336202672982, 16336202673346, 16336202673680, 16336202674087,
16336202674499, 16336202674909, 16336202675260, 16336202676110,
16336202676535, 16336202676913, 16336202677312, 16336202677658,
16336202678044, 16336202678413, 16336202678793, 16336202679208,
16336202679604, 16336202680034, 16336202680385, 16336202680799,
16336202681213, 16336202681595, 16336202682004, 16336202682346,
16336202682726, 16336202683158, 16336202683586, 16336202683990,
16336202684323, 16336202684742, 16336202685175, 16336202685578,
16336202685979, 16336202686805, 16336202687206, 16336202687614,
16336202688038, 16336202688473, 16336202688848, 16336202689221,
16336202689559, 16336202689971, 16336202690368, 16336202690776,
16336202691159, 16336202691585, 16336202692010, 16336202692373,
16336202692780, 16336202693179, 16336202693580, 16336202693991,
16336202694324, 16336202694727, 16336202695159, 16336202695588,
16336202695991, 16336202696335, 16336202697160, 16336202697542,
16336202697929, 16336202698323, 16336202698674, 16336202699060,
16336202699492, 16336202699835, 16336202700238, 16336202700658,
16336202701059, 16336202701420, 16336202701815, 16336202702229,
16336202702659, 16336202703857, 16336202704256, 16336202704659,
16336202705497, 16336202706309, 16336202706660, 16336202707085,
16336202707511, 16336202707866, 16336202708210, 16336202708552,
16336202708925, 16336202709287, 16336202709670, 16336202710045,
16336202710402, 16336202710802, 16336202711167, 16336202711533,
16336202712249, 16336202712660, 16336202713088, 16336202713519,
16336202713936, 16336202714355, 16336202714740, 16336202715160,
16336202715533, 16336202715878, 16336202716290, 16336202716708,
16336202717102, 16336202718290, 16336202718699, 16336202719052,
16336202719388, 16336202719808, 16336202720225, 16336202720659,
16336202721052, 16336202721414, 16336202721828, 16336202722925,
16336202723664, 16336202724063, 16336202724405, 16336202726003,
16336202726736, 16336202727158, 16336202727543, 16336202727930,
16336202728336, 16336202728703, 16336202729061, 16336202729483,
16336202729832, 16336202730222, 16336202730659, 16336202731084,
16336202731500, 16336202731911, 16336202732326, 16336202733158,
16336202733585, 16336202734001, 16336202734691, 16336202735042,
16336202735442, 16336202735863, 16336202736255, 16336202736671,
16336202737043, 16336202737884, 16336202738671, 16336202739110,
16336202739533, 16336202739886, 16336202740283, 16336202740706,
16336202741143, 16336202741534, 16336202741942, 16336202742352,
16336202742697, 16336202743103, 16336202743940, 16336202745172,
16336202745542, 16336202745937, 16336202746339, 16336202746758,
16336202747531, 16336202747877, 16336202748232, 16336202748658,
16336202749055, 16336202749468, 16336202749859, 16336202750416,
16336202750839, 16336202751178, 16336202751572, 16336202752002,
16336202752419, 16336202753269, 16336202753678, 16336202754086,
16336202754432, 16336202754835, 16336202755260, 16336202755683,
16336202756059, 16336202756402, 16336202756837, 16336202758084,
16336202758507, 16336202758879, 16336202759270, 16336202759674,
16336202760044, 16336202760400, 16336202760801, 16336202761659,
16336202762053, 16336202762397, 16336202763199, 16336202763547,
16336202763948, 16336202764714, 16336202765113, 16336202765947,
16336202766329, 16336202766664, 16336202767085, 16336202768233,
16336202769056, 16336202769758, 16336202770178, 16336202770585,
16336202770929, 16336202771325, 16336202772158, 16336202772594,
16336202773033, 16336202773403, 16336202773801, 16336202774179,
16336202774555, 16336202774989, 16336202775393, 16336202775809,
16336202776209, 16336202776618, 16336202777033, 16336202777421,
16336202777845, 16336202778246, 16336202778658, 16336202779055,
16336202779411, 16336202779761, 16336202780175, 16336202780594,
16336202781002, 16336202781848, 16336202782658, 16336202783033,
16336202783857, 16336202784211, 16336202784557, 16336202784972,
16336202785377, 16336202785810, 16336202786172, 16336202786934,
16336202787343, 16336202787765, 16336202788201, 16336202788563,
16336202788970, 16336202789329, 16336202789672, 16336202790055,
16336202790456, 16336202790802, 16336202791580, 16336202791920,
16336202792326, 16336202793158, 16336202793953, 16336202794368,
16336202795187, 16336202795622, 16336202796033, 16336202796393,
16336202796777, 16336202797173, 16336202797540, 16336202797975,
16336202798317, 16336202798739, 16336202799158, 16336202799567,
16336202799966, 16336202800378, 16336202800803, 16336202801232,
16336202801658, 16336202802033, 16336202802374, 16336202802759,
16336202803158, 16336202803533, 16336202803947, 16336202804354,
16336202804729, 16336202805158, 16336202805534, 16336202805950,
16336202806390, 16336202806805, 16336202807219, 16336202807643,
16336202808033, 16336202808377, 16336202808790, 16336202809211,
16336202809560, 16336202809920, 16336202810355, 16336202810758,
16336202811187, 16336202811596, 16336202811943, 16336202812348,
16336202812710, 16336202813060, 16336202813398, 16336202813791,
16336202814158, 16336202814533, 16336202814878, 16336202815246,
16336202815658, 16336202816079, 16336202816851, 16336202817202,
16336202817540, 16336202817905, 16336202818244, 16336202818663,
16336202819068, 16336202819418, 16336202819777, 16336202820193,
16336202820599, 16336202821033, 16336202821395, 16336202821745,
16336202822158, 16336202822590, 16336202822996, 16336202823396,
16336202823804, 16336202824210, 16336202824581, 16336202824991,
16336202825406, 16336202825806, 16336202826210, 16336202826598,
16336202827033, 16336202827446, 16336202827839, 16336202828201,
16336202828577, 16336202828968, 16336202829362, 16336202829709,
16336202830096, 16336202830533, 16336202830917, 16336202831290,
16336202831699, 16336202832035, 16336202832406, 16336202832804,
16336202833200, 16336202833604, 16336202834033, 16336202834386,
16336202834759, 16336202835190, 16336202835621, 16336202836033,
16336202836405, 16336202837191, 16336202837613, 16336202838033,
16336202838374, 16336202838798, 16336202839200, 16336202839603,
16336202840034, 16336202840389, 16336202840783, 16336202841200,
16336202841617, 16336202842034, 16336202842390, 16336202842737,
16336202843158, 16336202843585, 16336202843923, 16336202844313,
16336202844724, 16336202845158, 16336202845576, 16336202845939,
16336202846368, 16336202846728, 16336202847158, 16336202847568,
16336202847911, 16336202848291, 16336202848695, 16336202849103,
16336202849533, 16336202849942, 16336202850368, 16336202850747,
16336202851158, 16336202851549, 16336202851978, 16336202852383,
16336202852725, 16336202853158, 16336202853554, 16336202853961,
16336202854308, 16336202854704, 16336202855060, 16336202855418,
16336202855776, 16336202856203, 16336202856617, 16336202857036,
16336202857455, 16336202857884, 16336202858262, 16336202858658,
16336202859071, 16336202859847, 16336202860237, 16336202860658,
16336202861037, 16336202861452, 16336202861869, 16336202862218,
16336202862590, 16336202863001, 16336202863422, 16336202863857,
16336202864219, 16336202864658, 16336202865047, 16336202865404,
16336202865789, 16336202866210, 16336202866624, 16336202867033,
16336202867380, 16336202867797, 16336202868227, 16336202868658,
16336202869083, 16336202869500, 16336202869906, 16336202870246,
16336202870658, 16336202871086, 16336202871441, 16336202871820,
16336202872204, 16336202872546, 16336202872943, 16336202873380,
16336202873811, 16336202874213, 16336202874566, 16336202874918,
16336202875261, 16336202875655, 16336202876047, 16336202876771,
16336202877202, 16336202877612, 16336202878033, 16336202878412,
16336202878846, 16336202879241, 16336202879658, 16336202880072,
16336202880508, 16336202880901, 16336202881308, 16336202881725,
16336202882158, 16336202882579, 16336202882945, 16336202883286,
16336202883657, 16336202884048, 16336202884404, 16336202884752,
16336202885158, 16336202885533, 16336202885938, 16336202886364,
16336202886759, 16336202887175, 16336202887585, 16336202887929,
16336202888345, 16336202888743, 16336202889157, 16336202889570,
16336202889970, 16336202890382, 16336202890761, 16336202891187,
16336202891600, 16336202892033, 16336202892454, 16336202892794,
16336202893178, 16336202893533, 16336202893903, 16336202894264,
16336202894668, 16336202895049, 16336202895400, 16336202895774,
16336202896157, 16336202896537, 16336202896883, 16336202897232,
16336202897658, 16336202898065, 16336202898493, 16336202898884,
16336202899251, 16336202899673, 16336202900047, 16336202900467,
16336202900883, 16336202901300, 16336202901676, 16336202902068,
16336202902479, 16336202902902, 16336202903260, 16336202903675,
16336202904094, 16336202904476, 16336202904824, 16336202905158,
16336202905533, 16336202905934, 16336202906289, 16336202906717,
16336202907158, 16336202907547, 16336202907904, 16336202908294,
16336202908717, 16336202909157, 16336202909582, 16336202910005,
16336202910399, 16336202910800, 16336202911220, 16336202911657,
16336202912064, 16336202912405, 16336202912779, 16336202913158,
16336202913553, 16336202913966, 16336202914376, 16336202914719,
16336202915091, 16336202915515, 16336202915887, 16336202916293,
16336202916649, 16336202917438, 16336202917869, 16336202918221,
16336202919053, 16336202919425, 16336202919833, 16336202920234,
16336202920658, 16336202921033, 16336202921433, 16336202921801,
16336202922161, 16336202922589, 16336202923017, 16336202923418,
16336202923804, 16336202924199, 16336202924593, 16336202925033,
16336202925449, 16336202925818, 16336202926223, 16336202926662,
16336202927431, 16336202927812, 16336202928227, 16336202928658,
16336202929061, 16336202929473, 16336202929891, 16336202930241,
16336202930657, 16336202931057, 16336202931396, 16336202931811,
16336202932225, 16336202932657, 16336202933058, 16336202933445,
16336202933790, 16336202934157, 16336202934562, 16336202934988,
16336202935391, 16336202935777, 16336202936160, 16336202936562,
16336202936986, 16336202937396, 16336202937751, 16336202938158,
16336202938578, 16336202938985, 16336202939396, 16336202939752,
16336202940157, 16336202940585
],
"frameTimes": [
346, 411, 420, 382, 417, 433, 410, 431, 428, 375, 401, 415, 413, 382, 362,
380, 406, 353, 354, 389, 416, 425, 346, 432, 415, 393, 415, 367, 388, 401,
417, 376, 422, 375, 410, 392, 375, 418, 375, 352, 414, 764, 420, 776, 399,
418, 363, 335, 341, 386, 715, 426, 419, 417, 345, 409, 345, 428, 402, 393,
425, 426, 424, 379, 411, 426, 415, 445, 427, 398, 435, 405, 432, 427, 417,
420, 434, 397, 407, 339, 354, 416, 415, 364, 355, 398, 429, 361, 369, 407,
414, 342, 369, 429, 366, 440, 413, 363, 336, 375, 423, 409, 427, 769, 426,
352, 386, 353, 405, 435, 362, 375, 419, 388, 381, 376, 335, 382, 426, 389,
382, 399, 364, 355, 369, 429, 428, 352, 434, 423, 405, 362, 433, 423, 421,
420, 402, 355, 341, 409, 423, 411, 420, 346, 341, 381, 350, 356, 348, 339,
424, 420, 339, 430, 405, 427, 437, 373, 354, 412, 405, 426, 439, 349, 410,
414, 364, 407, 410, 850, 378, 346, 369, 415, 430, 414, 382, 342, 432, 404,
419, 403, 826, 408, 435, 373, 412, 408, 426, 363, 399, 411, 403, 429, 344,
382, 394, 386, 343, 420, 361, 414, 1198, 403, 812, 425, 355, 342, 362, 375,
400, 366, 411, 431, 419, 420, 345, 418, 1188, 353, 420, 434, 362, 1097, 399,
1598, 422, 387, 367, 422, 390, 425, 411, 832, 416, 351, 421, 416, 841, 439,
353, 423, 391, 410, 406, 1232, 395, 419, 346, 426, 413, 557, 339, 430, 850,
408, 403, 423, 343, 1247, 372, 404, 356, 858, 344, 348, 766, 834, 335, 1148,
702, 407, 396, 436, 370, 378, 434, 416, 409, 388, 401, 397, 350, 419, 846,
375, 354, 415, 433, 762, 422, 362, 359, 383, 346, 340, 832, 415, 435, 360,
396, 435, 422, 409, 412, 429, 375, 385, 375, 407, 429, 416, 415, 424, 344,
421, 360, 403, 409, 405, 350, 393, 375, 368, 421, 351, 365, 419, 350, 416,
434, 350, 432, 400, 406, 410, 400, 388, 413, 362, 391, 347, 437, 373, 336,
398, 404, 353, 431, 412, 786, 420, 424, 403, 355, 417, 417, 347, 427, 390,
434, 363, 360, 410, 380, 408, 409, 379, 391, 405, 433, 407, 396, 358, 427,
419, 429, 396, 776, 421, 415, 349, 411, 435, 439, 357, 421, 409, 417, 431,
417, 340, 428, 379, 342, 437, 402, 352, 394, 724, 410, 379, 395, 414, 393,
417, 421, 341, 391, 348, 375, 426, 416, 344, 398, 413, 412, 426, 433, 340,
355, 361, 381, 374, 380, 349, 407, 391, 422, 420, 417, 392, 423, 415, 382,
334, 401, 428, 389, 390, 440, 423, 401, 437, 341, 379, 413, 343, 424, 406,
789, 352, 372, 401, 375, 368, 428, 401, 395, 440, 369, 439, 381, 431, 412,
350, 400, 415, 432, 387, 367, 426, 386, 402, 410, 407, 407, 356, 428
],
"percentileMs": {
"50": 40.7,
"75": 42.3,
"90": 43.5,
"95": 76.4,
"99": 118.8
}
}

View File

@@ -0,0 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {}
}
}

View File

@@ -0,0 +1,5 @@
import reactRefresh from "@vitejs/plugin-react-refresh";
export default {
plugins: [reactRefresh()],
};

View File

@@ -0,0 +1,15 @@
# Benchmarking hot module reloading
## Methodology
How do you benchmark hot module reloading? What do you call "done" and what do you call "start"?
The answer for "done" is certainly not compilation time. Compilation time is one step.
I think the answer should be different depending on the type of content loaded.
For CSS, the answer should be "when the updated stylesheet was drawn on the screen"
For JavaScript, the answer should be "when the rebuilt code completed execution such that any changes are applied"
For images & assets, the answer should be "when the updated asset finished loading"
The start time should be defined as "the timestamp the filesystem set as the write time". As in, the time the developer pressed save in their editor.

1
build-id Normal file
View File

@@ -0,0 +1 @@
60

487
build.zig
View File

@@ -1,35 +1,490 @@
const std = @import("std");
const resolve_path = @import("./src/resolver/resolve_path.zig");
pub fn build(b: *std.build.Builder) void {
fn pkgPath(comptime out: []const u8) std.build.FileSource {
const outpath = comptime std.fs.path.dirname(@src().file).? ++ std.fs.path.sep_str ++ out;
return .{ .path = outpath };
}
pub fn addPicoHTTP(step: *std.build.LibExeObjStep, comptime with_obj: bool) void {
step.addIncludeDir("src/deps");
if (with_obj) {
step.addObjectFile("src/deps/picohttpparser.o");
}
step.addIncludeDir("src/deps");
if (with_obj) {
step.addObjectFile(panicIfNotFound("src/deps/picohttpparser.o"));
step.addObjectFile(panicIfNotFound("src/deps/libssl.a"));
step.addObjectFile(panicIfNotFound("src/deps/libcrypto.a"));
}
// 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
}
const color_map = std.ComptimeStringMap([]const u8, .{
&.{ "black", "30m" },
&.{ "blue", "34m" },
&.{ "b", "1m" },
&.{ "d", "2m" },
&.{ "cyan", "36m" },
&.{ "green", "32m" },
&.{ "magenta", "35m" },
&.{ "red", "31m" },
&.{ "white", "37m" },
&.{ "yellow", "33m" },
});
fn addInternalPackages(step: *std.build.LibExeObjStep, allocator: *std.mem.Allocator, target: anytype) !void {
var boringssl: std.build.Pkg = .{
.name = "boringssl",
.path = pkgPath("src/deps/boringssl.zig"),
};
var thread_pool: std.build.Pkg = .{
.name = "thread_pool",
.path = pkgPath("src/thread_pool.zig"),
};
var picohttp: std.build.Pkg = .{
.name = "picohttp",
.path = pkgPath("src/deps/picohttp.zig"),
};
var io_darwin: std.build.Pkg = .{
.name = "io",
.path = pkgPath("src/io/io_darwin.zig"),
};
var io_linux: std.build.Pkg = .{
.name = "io",
.path = pkgPath("src/io/io_linux.zig"),
};
var io = if (target.isDarwin())
io_darwin
else
io_linux;
var strings: std.build.Pkg = .{
.name = "strings",
.path = pkgPath("src/string_immutable.zig"),
};
var clap: std.build.Pkg = .{
.name = "clap",
.path = pkgPath("src/deps/zig-clap/clap.zig"),
};
var http: std.build.Pkg = .{
.name = "http",
.path = pkgPath("src/http_client_async.zig"),
};
var network_thread: std.build.Pkg = .{
.name = "network_thread",
.path = pkgPath("src/http/network_thread.zig"),
};
thread_pool.dependencies = &.{ io, http };
network_thread.dependencies = &.{
io,
thread_pool,
};
http.dependencies = &.{ io, network_thread, strings, boringssl, picohttp };
thread_pool.dependencies = &.{ io, http };
http.dependencies = &.{ io, network_thread, thread_pool, strings, boringssl, picohttp };
step.addPackage(thread_pool);
step.addPackage(picohttp);
step.addPackage(io);
step.addPackage(strings);
step.addPackage(clap);
step.addPackage(http);
step.addPackage(network_thread);
step.addPackage(boringssl);
}
var output_dir: []const u8 = "";
fn panicIfNotFound(comptime filepath: []const u8) []const u8 {
var file = std.fs.cwd().openFile(filepath, .{ .read = true }) catch |err| {
std.debug.panic("error: {s} opening {s}. Please ensure you've downloaded git submodules, and ran `make vendor`, `make jsc`.", .{ filepath, @errorName(err) });
};
file.close();
return filepath;
}
fn updateRuntime() anyerror!void {
var runtime_out_file = try std.fs.cwd().openFile("src/runtime.out.js", .{ .read = true });
const runtime_hash = std.hash.Wyhash.hash(
0,
try runtime_out_file.readToEndAlloc(std.heap.page_allocator, try runtime_out_file.getEndPos()),
);
const runtime_version_file = std.fs.cwd().createFile("src/runtime.version", .{ .truncate = true }) catch std.debug.panic("Failed to create src/runtime.version", .{});
defer runtime_version_file.close();
runtime_version_file.writer().print("{x}", .{runtime_hash}) catch unreachable;
var fallback_out_file = try std.fs.cwd().openFile("src/fallback.out.js", .{ .read = true });
const fallback_hash = std.hash.Wyhash.hash(
0,
try fallback_out_file.readToEndAlloc(std.heap.page_allocator, try fallback_out_file.getEndPos()),
);
const fallback_version_file = std.fs.cwd().createFile("src/fallback.version", .{ .truncate = true }) catch std.debug.panic("Failed to create src/fallback.version", .{});
fallback_version_file.writer().print("{x}", .{fallback_hash}) catch unreachable;
fallback_version_file.close();
}
var x64 = "x64";
var mode: std.builtin.Mode = undefined;
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(.{});
var target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
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-" else "packages/bun-";
var triplet_buf: [64]u8 = undefined;
var os_tagname = @tagName(target.getOs().tag);
const arch: std.Target.Cpu.Arch = target.getCpuArch();
if (std.mem.eql(u8, os_tagname, "macos")) {
os_tagname = "darwin";
if (arch.isAARCH64()) {
target.os_version_min = std.build.Target.OsVersion{ .semver = .{ .major = 11, .minor = 0, .patch = 0 } };
} else if (arch.isX86()) {
target.os_version_min = std.build.Target.OsVersion{ .semver = .{ .major = 10, .minor = 14, .patch = 0 } };
}
}
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_label, triplet });
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.setOutputDir(output_dir);
var cwd_dir = std.fs.cwd();
updateRuntime() catch {};
exe.setTarget(target);
exe.setBuildMode(mode);
b.install_path = output_dir;
exe.addLibPath("/usr/local/lib");
exe.install();
var typings_exe = b.addExecutable("typescript-decls", "src/javascript/jsc/typescript.zig");
typings_exe.setMainPkgPath(b.pathFromRoot("."));
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
// exe.want_lto = true;
{
b.default_step.dependOn(&b.addLog(
"Build {s} v{} - v{}",
.{
triplet,
target.getOsVersionMin().semver,
target.getOsVersionMax().semver,
},
).step);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
var obj_step = b.step("obj", "Build Bun as a .o file");
var obj = b.addObject(bun_executable_name, exe.root_src.?.path);
{
obj.setTarget(target);
addPicoHTTP(obj, false);
obj.setMainPkgPath(b.pathFromRoot("."));
try addInternalPackages(
obj,
b.allocator,
target,
);
{
obj_step.dependOn(&b.addLog(
"Build {s} v{} - v{}\n",
.{
triplet,
obj.target.getOsVersionMin().semver,
obj.target.getOsVersionMax().semver,
},
).step);
}
obj_step.dependOn(&obj.step);
obj.setOutputDir(output_dir);
obj.setBuildMode(mode);
obj.linkLibC();
obj.linkLibCpp();
obj.strip = false;
obj.bundle_compiler_rt = true;
b.default_step.dependOn(&obj.step);
if (target.getOsTag() == .linux) {
// obj.want_lto = tar;
obj.link_emit_relocs = true;
obj.link_function_sections = true;
}
var log_step = b.addLog("Destination: {s}/{s}\n", .{ output_dir, bun_executable_name });
log_step.step.dependOn(&obj.step);
}
{
const headers_step = b.step("headers-obj", "Build JavaScriptCore headers");
var headers_obj: *std.build.LibExeObjStep = b.addObject("headers", "src/bindgen.zig");
defer headers_step.dependOn(&headers_obj.step);
try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
}
{
const headers_step = b.step("httpbench-obj", "Build HTTPBench tool (object files)");
var headers_obj: *std.build.LibExeObjStep = b.addObject("httpbench", "misctools/http_bench.zig");
defer headers_step.dependOn(&headers_obj.step);
try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
}
{
const headers_step = b.step("fetch-obj", "Build fetch (object files)");
var headers_obj: *std.build.LibExeObjStep = b.addObject("fetch", "misctools/fetch.zig");
defer headers_step.dependOn(&headers_obj.step);
try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
}
{
const headers_step = b.step("tgz-obj", "Build tgz (object files)");
var headers_obj: *std.build.LibExeObjStep = b.addObject("tgz", "misctools/tgz.zig");
defer headers_step.dependOn(&headers_obj.step);
try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
}
{
const headers_step = b.step("test", "Build test");
var test_file = b.option([]const u8, "test-file", "Input file for test");
var test_bin_ = b.option([]const u8, "test-bin", "Emit bin to");
var test_filter = b.option([]const u8, "test-filter", "Filter for test");
var headers_obj: *std.build.LibExeObjStep = b.addTest(test_file orelse "src/main.zig");
headers_obj.setFilter(test_filter);
if (test_bin_) |test_bin| {
headers_obj.name = std.fs.path.basename(test_bin);
if (std.fs.path.dirname(test_bin)) |dir| headers_obj.setOutputDir(dir);
}
try configureObjectStep(headers_obj, target, obj.main_pkg_path.?);
try linkObjectFiles(b, headers_obj, target);
{
var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{s} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{"bun"});
var after = b.addLog("\x1b[" ++ color_map.get("d").? ++ "---\n\n" ++ "\x1b[0m", .{});
headers_step.dependOn(&before.step);
headers_step.dependOn(&headers_obj.step);
headers_step.dependOn(&after.step);
}
for (headers_obj.packages.items) |pkg_| {
const pkg: std.build.Pkg = pkg_;
if (std.mem.eql(u8, pkg.name, "clap")) continue;
var test_ = b.addTestSource(pkg.path);
test_.setMainPkgPath(obj.main_pkg_path.?);
test_.setTarget(target);
try linkObjectFiles(b, test_, target);
if (pkg.dependencies) |children| {
test_.packages = std.ArrayList(std.build.Pkg).init(b.allocator);
try test_.packages.appendSlice(children);
}
var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{s} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{pkg.name});
var after = b.addLog("\x1b[" ++ color_map.get("d").? ++ "---\n\n" ++ "\x1b[0m", .{});
headers_step.dependOn(&before.step);
headers_step.dependOn(&test_.step);
headers_step.dependOn(&after.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);
}
pub var original_make_fn: ?fn (step: *std.build.Step) anyerror!void = null;
// Due to limitations in std.build.Builder
// we cannot use this with debugging
// so I am leaving this here for now, with the eventual intent to switch to std.build.Builder
// but it is dead code
pub fn linkObjectFiles(b: *std.build.Builder, obj: *std.build.LibExeObjStep, target: anytype) !void {
var dirs_to_search = std.BoundedArray([]const u8, 32).init(0) catch unreachable;
const arm_brew_prefix: []const u8 = "/opt/homebrew";
const x86_brew_prefix: []const u8 = "/usr/local";
try dirs_to_search.append(b.env_map.get("BUN_DEPS_DIR") orelse @as([]const u8, b.pathFromRoot("src/deps")));
if (target.getOsTag() == .macos) {
if (target.getCpuArch().isAARCH64()) {
try dirs_to_search.append(comptime arm_brew_prefix ++ "/opt/icu4c/lib/");
} else {
try dirs_to_search.append(comptime x86_brew_prefix ++ "/opt/icu4c/lib/");
}
}
if (b.env_map.get("JSC_LIB")) |jsc| {
try dirs_to_search.append(jsc);
}
var added = std.AutoHashMap(u64, void).init(b.allocator);
const files_we_care_about = std.ComptimeStringMap([]const u8, .{
.{ "libmimalloc.o", "libmimalloc.o" },
.{ "libz.a", "libz.a" },
.{ "libarchive.a", "libarchive.a" },
.{ "libssl.a", "libssl.a" },
.{ "picohttpparser.o", "picohttpparser.o" },
.{ "libcrypto.boring.a", "libcrypto.boring.a" },
.{ "libicuuc.a", "libicuuc.a" },
.{ "libicudata.a", "libicudata.a" },
.{ "libicui18n.a", "libicui18n.a" },
.{ "libJavaScriptCore.a", "libJavaScriptCore.a" },
.{ "libWTF.a", "libWTF.a" },
.{ "libbmalloc.a", "libbmalloc.a" },
});
for (dirs_to_search.slice()) |deps_path| {
var deps_dir = std.fs.cwd().openDir(deps_path, .{ .iterate = true }) catch |err| @panic("Failed to open dependencies directory");
var iterator = deps_dir.iterate();
while (iterator.next() catch null) |entr| {
const entry: std.fs.Dir.Entry = entr;
if (files_we_care_about.get(entry.name)) |obj_name| {
var has_added = try added.getOrPut(std.hash.Wyhash.hash(0, obj_name));
if (!has_added.found_existing) {
var paths = [_][]const u8{ deps_path, obj_name };
obj.addObjectFile(try std.fs.path.join(b.allocator, &paths));
}
}
}
}
}
pub fn configureObjectStep(obj: *std.build.LibExeObjStep, target: anytype, main_pkg_path: []const u8) !void {
obj.setMainPkgPath(main_pkg_path);
obj.setTarget(target);
try addInternalPackages(obj, std.heap.page_allocator, target);
addPicoHTTP(obj, false);
obj.setOutputDir(output_dir);
obj.setBuildMode(mode);
obj.linkLibC();
obj.linkLibCpp();
obj.bundle_compiler_rt = true;
if (target.getOsTag() == .linux) {
// obj.want_lto = tar;
obj.link_emit_relocs = true;
obj.link_function_sections = true;
}
}

BIN
bun.lockb Executable file

Binary file not shown.

8
completions/bun.bash Normal file
View File

@@ -0,0 +1,8 @@
#/usr/bin/env bash
# This is not implemented yet.
# But a PR implementing it would be very welcome!
_bun_completions() {
}
complete -F _bun_completions bun

149
completions/bun.fish Normal file
View File

@@ -0,0 +1,149 @@
# This is terribly complicated
# It's because:
# 1. bun run has to have dynamic completions
# 2. there are global options
# 3. bun {install add remove} gets special options
# 4. I don't know how to write fish completions well
# Contributions very welcome!!
function __fish__get_bun_bins
string split ' ' (bun getcompletes b)
end
function __fish__get_bun_scripts
set -lx SHELL bash
set -lx MAX_DESCRIPTION_LEN 40
string trim (string split '\n' (string split '\t' (bun getcompletes z)))
end
function __fish__get_bun_packages
if test (commandline -ct) != ""
set -lx SHELL fish
string split ' ' (bun getcompletes a (commandline -ct))
end
end
function __history_completions
set -l tokens (commandline --current-process --tokenize)
history --prefix (commandline) | string replace -r \^$tokens[1]\\s\* "" | string replace -r \^$tokens[2]\\s\* "" | string split ' '
end
function __fish__get_bun_bun_js_files
string split ' ' (bun getcompletes j)
end
function bun_fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n
set -l tokens (commandline -poc)
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
test (count $tokens) -eq "$n"
end
function __bun_command_count --argument-names n
set -l cmds (commandline -poc)
test (count cmds) -eq "$n"
end
function __bun_last_cmd --argument-names n
set -l cmds (commandline -poc)
test "(cmds[-1])" = "$n"
end
set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't install devDependencies" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependenices" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging"
set -l bun_builtin_cmds dev create help bun upgrade discord run install remove add
set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add
set -l bun_builtin_cmds_without_bun dev create help upgrade run discord install remove add
set -l bun_builtin_cmds_without_create dev help bun upgrade discord run install remove add
set -l bun_builtin_cmds_without_install create dev help bun upgrade discord run remove add
set -l bun_builtin_cmds_without_remove create dev help bun upgrade discord run install add
set -l bun_builtin_cmds_without_add create dev help bun upgrade discord run remove install
set -l bun_builtin_cmds_without_pm create dev help bun upgrade discord run
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '(__fish__get_bun_scripts)' -d 'script'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bins)' -d 'package bin'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_scripts)' -d 'script'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_run; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from run" -a '(__fish__get_bun_bun_js_files)' -d 'Bun.js'
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a 'run' -f -d 'Run a script or bin'
complete -c bun \
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'u' -l 'origin' -r -d 'Server URL. Rewrites import paths'
complete -c bun \
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'p' -l 'port' -r -d 'Port number to start server from'
complete -c bun \
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'd' -l 'define' -r -d 'Substitute K:V while parsing, e.g. --define process.env.NODE_ENV:\"development\"'
complete -c bun \
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -s 'e' -l 'external' -r -d 'Exclude module from transpilation (can use * wildcards). ex: -e react'
complete -c bun \
-n "not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) install remove add;" --no-files -l 'use' -r -d 'Use a framework (ex: next)'
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __fish_use_subcommand" -a 'dev' -d 'Start dev server'
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'create' -f -d 'Create a new project'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a 'next' -d 'new Next.js project'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create next react; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from create;" -a 'react' -d 'new React project'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a 'upgrade' -d 'Upgrade Bun to the latest version' -x
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a '--help' -d 'See all commands and flags' -x
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -l "version" -s "v" -a '--version' -d 'Bun\'s version' -x
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_use_subcommand" -a 'discord' -d 'Open Bun\'s Discord server' -x
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); __fish_use_subcommand" -a 'bun' -d 'Generate a new bundle'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_bun; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from bun" -F -d 'Bundle this'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_create; and not __fish_seen_subcommand_from (__fish__get_bun_bins); and not __fish_seen_subcommand_from (__fish__get_bun_scripts); and __fish_seen_subcommand_from react; or __fish_seen_subcommand_from next" -F -d "Create in directory"
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'install' -f -d 'Install packages from package.json'
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'add' -F -d 'Add a package to package.json'
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand" -a 'remove' -F -d 'Remove a package from package.json'
complete -c bun \
-n "bun_fish_is_nth_token 1; and not __fish_seen_subcommand_from $bun_builtin_cmds; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) and __bun_command_count 1 and __fish_use_subcommand add remove" -F
for i in (seq (count $bun_install_boolean_flags))
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l "$bun_install_boolean_flags[$i]" -d "$bun_install_boolean_flags_descriptions[$i]"
end
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l 'cwd' -d 'Change working directory'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from install add remove;" -l 'cache-dir' -d 'Choose a cache directory (default: $HOME/.bun/install/cache)'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d 'Popular' -a '(__fish__get_bun_packages)'
complete -c bun \
-n "not __fish_seen_subcommand_from $bun_builtin_cmds_without_pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts); and __fish_seen_subcommand_from add;" -d 'History' -a '(__history_completions)'
complete -c bun --no-files

552
completions/bun.zsh Normal file
View File

@@ -0,0 +1,552 @@
_bun() {
local program=bun
typeset -A opt_args
local curcontext="$curcontext" state line context
# ---- Command:
_arguments -s \
'1: :->cmd' \
'*: :->args' &&
ret=0
case $state in
cmd)
local -a scripts_list
IFS=$'\n' scripts_list=($(SHELL=zsh bun getcompletes i))
compadd $scripts_list && ret=0
main_commands=('add\:"Add a dependency to package.json" bun\:"Generate a bundle" create\:"Create a new project" dev\:"Start a dev server" help\:"Show command help" install\:"Install packages from package.json" remove\:"Remove a dependency from package.json" run\:"Run a script or package bin" upgrade\:"Upgrade to the latest version of Bun"')
main_commands=($main_commands)
_alternative "args:Bun:(($main_commands))"
;;
args)
case $line[1] in
add)
# ---- Command: add
_arguments -s -C \
'1: :->cmd1' \
'*: :->package' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--registry[Change default registry (default: \$BUN_CONFIG_REGISTRY || \$npm_config_registry)]:registry' \
'--token[Authentication token used for npm registry requests (default: \$npm_config_token)]:token' \
'-y[Write a yarn.lock file (yarn v1)]' \
'--yarn[Write a yarn.lock file (yarn v1)]' \
'--production[Don'"'"'t install devDependencies]' \
'--optional[Add dependency to optionalDependencies]' \
'--development[Add dependency to devDependencies]' \
'-d[Add dependency to devDependencies]' \
'-p[Don'"'"'t install devDependencies]' \
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
'--verbose[Excessively verbose logging]' \
'--cwd[Set a specific cwd]:cwd' \
'--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \
'--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' &&
ret=0
case $state in
package)
_bun_add_param_package_completion
;;
esac
;;
bun)
# ---- Command: bun
_arguments -s -C \
'1: :->cmd' \
'*: :->file' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--use[Use a framework, e.g. "next"]:use' &&
ret=0
case $state in
file)
_files
;;
esac
;;
create)
# ---- Command: create
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'*: :->args' &&
ret=0
case $state in
cmd2)
_alternative 'args:create:((next\:"Next.js app" react\:"React app"))'
;;
args)
case $line[2] in
next)
# ---- Command: create next
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'3: :->file' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' &&
ret=0
case $state in
file)
_files
;;
esac
;;
react)
# ---- Command: create react
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'3: :->file' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' &&
ret=0
case $state in
file)
_files
;;
esac
;;
esac
;;
esac
;;
dev)
# ---- Command: dev
_arguments -s -C \
'1: :->cmd' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--bunfile[Use a specific .bun file (default: node_modules.bun)]:bunfile' \
'--origin[Rewrite import paths to start from a different url. Default: http://localhost:3000]:origin' \
'-u[Rewrite import paths to start from a different url. Default: http://localhost:3000]:u' \
'--server-bunfile[Use a specific .bun file for SSR in bun dev (default: node_modules.server.bun)]:server-bunfile' \
'--extension-order[defaults to: .tsx,.ts,.jsx,.js,.json]:extension-order' \
'--jsx-runtime[JSX runtime to use. Defaults to "automatic"]:jsx-runtime:("automatic" "classic")' \
'--main-fields[Main fields to lookup in package.json. Defaults to --platform dependent]:main-fields' \
'--disable-react-fast-refresh[Disable React Fast Refresh]' \
'--disable-hmr[Disable Hot Module Reloading]' \
'--jsx-factory[Changes the function called when compiling JSX elements using the classic JSX runtime]:jsx-factory' \
'--jsx-fragment[Changes the function called when compiling JSX fragments]:jsx-fragment' \
'--jsx-import-source[Declares the module specifier to be used for importing the jsx and jsxs factory functions. Default: "react"]:jsx-import-source' \
'--port[Port number]:port' &&
ret=0
;;
help)
# ---- Command: help
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'*: :->args' &&
ret=0
case $state in
cmd2)
_alternative 'args:cmd3:((bun create dev run upgrade))'
;;
args)
case $line[2] in
bun)
# ---- Command: help bun
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
install)
# ---- Command: help install
_arguments -s -C \
'1: :->cmd1' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
remove)
# ---- Command: help remove
_arguments -s -C \
'1: :->cmd1' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
run)
# ---- Command: help run
_arguments -s -C \
'1: :->cmd1' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
create)
# ---- Command: help create
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'3: :->cmd3' \
'*: :->args' &&
ret=0
case $state in
cmd3)
_alternative 'args:create:((next react))'
;;
args)
case $line[3] in
next)
# ---- Command: help create next
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'3: :->cmd3' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
react)
# ---- Command: help create react
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'3: :->cmd3' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
esac
;;
esac
;;
dev)
# ---- Command: help dev
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
run)
# ---- Command: help run
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
upgrade)
# ---- Command: help upgrade
_arguments -s -C \
'1: :->cmd' \
'2: :->cmd2' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--all[]' &&
ret=0
;;
esac
;;
esac
;;
install)
# ---- Command: install
_arguments -s -C \
'1: :->cmd1' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--help[Show command help]' \
'-h[Show command help]' \
'--registry[Change default registry (default: \$BUN_CONFIG_REGISTRY || \$npm_config_registry)]:registry' \
'--token[Authentication token used for npm registry requests (default: \$npm_config_token)]:token' \
'-y[Write a yarn.lock file (yarn v1)]' \
'--yarn[Write a yarn.lock file (yarn v1)]' \
'--production[Don'"'"'t install devDependencies]' \
'-p[Don'"'"'t install devDependencies]' \
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
'--verbose[Excessively verbose logging]' \
'--cwd[Set a specific cwd]:cwd' \
'--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \
'--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' &&
ret=0
;;
remove)
# ---- Command: remove
_arguments -s -C \
'1: :->cmd1' \
'*: :->package' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--help[Show command help]' \
'-h[Show command help]' \
'--registry[Change default registry (default: \$BUN_CONFIG_REGISTRY || \$npm_config_registry)]:registry' \
'--token[Authentication token used for npm registry requests (default: \$npm_config_token)]:token' \
'-y[Write a yarn.lock file (yarn v1)]' \
'--yarn[Write a yarn.lock file (yarn v1)]' \
'--production[Don'"'"'t install devDependencies]' \
'-p[Don'"'"'t install devDependencies]' \
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
'--verbose[Excessively verbose logging]' \
'--backend[Platform-specific optimizations for installing dependencies]:backend:("clonefile" "copyfile" "hardlink" "clonefile_each_dir")' \
'--link-native-bins[Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo]:link-native-bins' &&
ret=0
case $state in
package) ;;
esac
;;
run)
# ---- Command: run
_arguments -s -C \
'1: :->cmd' \
'2: :->script' \
'*: :->other' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' \
'--silent[Don'"'"'t echo the command]' &&
ret=0
case $state in
script)
_bun_run_param_script_completion
;;
other)
_files
;;
esac
;;
upgrade)
# ---- Command: upgrade
_arguments -s -C \
'1: :->cmd' \
'--version[Show version and exit]' \
'-V[Show version and exit]' \
'--cwd[Change directory]:cwd' \
'--help[Show command help]' \
'-h[Show command help]' &&
ret=0
;;
esac
;;
esac
}
_bun_run_param_script_completion() {
local -a scripts_list
IFS=$'\n' scripts_list=($(SHELL=zsh bun getcompletes s))
compadd $scripts_list && ret=0
IFS=$'\n' bunjs=($(SHELL=zsh bun getcompletes j))
IFS=$'\n' bins=($(SHELL=zsh bun getcompletes b))
if [ ! -z "$bunjs" -a "$bunjs" != " " ]; then
if [ ! -z "$bins" -a "$bins" != " " ]; then
compadd $bunjs && ret=0
_alternative "args:bin:(($bins))"
return 1
fi
_alternative "args:Bun.js:(($bunjs))"
fi
if [ ! -z "$bins" -a "$bins" != " " ]; then
_alternative "args:bin:(($bins))"
return 1
fi
}
_set_remove() {
comm -23 <(echo $1 | sort | tr " " "\n") <(echo $2 | sort | tr " " "\n") 2>/dev/null
}
_bun_add_param_package_completion() {
IFS=$'\n' inexact=($(history -n bun | grep -E "^bun add " | cut -c 9- | uniq))
IFS=$'\n' exact=($($inexact | grep -E "^$words[$CURRENT]"))
IFS=$'\n' packages=($(SHELL=zsh bun getcompletes a $words[$CURRENT]))
to_print=$inexact
if [ ! -z "$exact" -a "$exact" != " " ]; then
to_print=$exact
fi
if [ ! -z "$to_print" -a "$to_print" != " " ]; then
if [ ! -z "$packages" -a "$packages" != " " ]; then
_describe -1 -t to_print 'History' to_print
_describe -1 -t packages "Popular" packages
return
fi
_describe -1 -t to_print 'History' to_print
return
fi
if [ ! -z "$packages" -a "$packages" != " " ]; then
_describe -1 -t packages "Popular" packages
return
fi
}
__bun_dynamic_comp() {
local comp=""
for arg in scripts; do
local line
while read -r line; do
local name="$line"
local desc="$line"
name="${name%$'\t'*}"
desc="${desc/*$'\t'/}"
echo
done <<<"$arg"
done
return $comp
}
autoload -U compinit && compinit
compdef _bun bun

229
completions/spec.yaml Normal file
View File

@@ -0,0 +1,229 @@
---
name: bun
appspec: { version: "0.001" }
plugins: [-Meta]
title: A tool for installing and managing Python packages
options:
- version|V --Show version and exit
- name: cwd
type: string
summary: "Change directory"
# subcommands:
# bun:
subcommands:
run:
summary: Run a script or package bin
parameters:
- name: script
multiple: false
completion:
command_string: >
SHELL=zsh bun getcompletes r
options:
- silent --Don't echo the command
create:
summary: Create a new project
subcommands:
next:
summary: "Next.js app"
parameters:
- name: file
multiple: false
type: file
required: true
react:
summary: "React app"
parameters:
- name: file
multiple: false
type: file
required: true
bun:
summary: Generate a bundle
parameters:
- name: file
multiple: true
type: file
required: false
options:
- name: use
type: string
summary: Use a framework, e.g. "next"
upgrade:
summary: Upgrade to the latest version of Bun
dev:
summary: Start a dev server
options:
- name: bunfile
type: string
summary: "Use a specific .bun file (default: node_modules.bun)"
- name: origin
type: string
summary: "Rewrite import paths to start from a different url. Default: http://localhost:3000"
- name: u
type: string
summary: "Rewrite import paths to start from a different url. Default: http://localhost:3000"
- name: server-bunfile
type: string
summary: "Use a specific .bun file for SSR in bun dev (default: node_modules.server.bun)"
- name: extension-order
type: string
summary: "defaults to: .tsx,.ts,.jsx,.js,.json"
- name: "jsx-runtime"
type: string
enum: ["automatic", "classic"]
summary: 'JSX runtime to use. Defaults to "automatic"'
- name: main-fields
type: string
summary: Main fields to lookup in package.json. Defaults to --platform dependent
- disable-react-fast-refresh --Disable React Fast Refresh
- disable-hmr --Disable Hot Module Reloading
- &jsx_factory name: jsx-factory
type: string
summary: "Changes the function called when compiling JSX elements using the classic JSX runtime"
- &jsx_fragment name: jsx-fragment
type: string
summary: "Changes the function called when compiling JSX fragments"
- &jsx_import_source name: jsx-import-source
type: string
summary: 'Declares the module specifier to be used for importing the jsx and jsxs factory functions. Default: "react"'
- &port name: port
type: int
summary: Port number
install:
summary: Install packages from package.json
options:
- name: registry
type: string
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
- name: token
type: string
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
- y -- "Write a yarn.lock file (yarn v1)"
- yarn -- "Write a yarn.lock file (yarn v1)"
- production -- "Don't install devDependencies"
- p -- "Don't install devDependencies"
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: cwd
type: string
summary: "Set a specific cwd"
- name: backend
summary: "Platform-specific optimizations for installing dependencies"
type: string
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
- name: link-native-bins
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
add:
summary: Add a dependency to package.json
options:
- name: registry
type: string
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
- name: token
type: string
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
- y -- "Write a yarn.lock file (yarn v1)"
- yarn -- "Write a yarn.lock file (yarn v1)"
- production -- "Don't install devDependencies"
- optional -- "Add dependency to optionalDependencies"
- development -- "Add dependency to devDependencies"
- d -- "Add dependency to devDependencies"
- p -- "Don't install devDependencies"
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
- name: cwd
type: string
summary: "Set a specific cwd"
- name: backend
summary: "Platform-specific optimizations for installing dependencies"
type: string
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
- name: link-native-bins
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
parameters:
- name: package
multiple: true
type: string
required: true
remove:
summary: Remove a dependency from package.json
options:
- name: registry
type: string
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
- name: token
type: string
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
- y -- "Write a yarn.lock file (yarn v1)"
- yarn -- "Write a yarn.lock file (yarn v1)"
- production -- "Don't install devDependencies"
- p -- "Don't install devDependencies"
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: cwd
type: string
summary: "Set a specific cwd"
- name: backend
summary: "Platform-specific optimizations for installing dependencies"
type: string
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
- name: link-native-bins
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
parameters:
- name: package
multiple: true
type: string
required: true
parameters:
- name: sasdasdds
completion:
command_string: >
SHELL=zsh bun getcompletes r
# vim:et:sts=2:sws=2:sw=2:foldmethod=indent

16
entitlements.plist Normal file
View File

@@ -0,0 +1,16 @@
<?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.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>

1
examples/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
bun-examples-all

View File

View File

@@ -0,0 +1,33 @@
import { fetchCSV } from "macro:fetchCSV";
export const Covid19 = () => {
const rows = fetchCSV(
"https://covid19.who.int/WHO-COVID-19-global-data.csv",
{
last: 100,
columns: ["New_cases", "Date_reported", "Country"],
}
);
return (
<div>
<h2>Covid-19</h2>
<h6>last {rows.length} updates from the WHO</h6>
<div className="Table">
<div className="Header">
<div className="Heading">New Cases</div>
<div className="Heading">Date</div>
<div className="Heading">Country</div>
</div>
{rows.map((row, index) => (
<div className="Row" key={index}>
<div className="Column">{row[0]}</div>
<div className="Column">{row[1]}</div>
<div className="Column">{row[2]}</div>
</div>
))}
</div>
</div>
);
};

View File

@@ -0,0 +1,17 @@
// source code
import { matchInFile } from "macro:matchInFile";
export const IPAddresses = () => (
<div>
<h2>recent ip addresses</h2>
<div className="Lines">
{matchInFile("access.log", /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/).map(
(ipAddress, index) => (
<div className="Line" key={index}>
{ipAddress}
</div>
)
)}
</div>
</div>
);

View File

@@ -0,0 +1,15 @@
import * as ReactDOM from "react-dom";
import * as React from "react";
import { IPAddresses } from "./example";
import { Covid19 } from "./covid19";
const Start = function () {
const root = document.createElement("div");
document.body.appendChild(root);
// comment out to switch between examples
// ReactDOM.render(<IPAddresses />, root);
ReactDOM.render(<Covid19 />, root);
};
Start();

View File

@@ -0,0 +1,4 @@
// source code
import { mysteryBox } from "macro:./mystery-box";
export default "You roll! " + mysteryBox(123);

View File

@@ -0,0 +1,54 @@
import Pappa from "papaparse";
// Example usage:
// const rows = fetchCSV(
// "https://covid19.who.int/WHO-COVID-19-global-data.csv",
// {
// last: 100,
// columns: ["New_cases", "Date_reported", "Country"],
// }
// );
export async function fetchCSV(callExpression) {
console.time("fetchCSV Total");
const [
urlNode,
{
properties: { last: limit = 10, columns = [] },
},
] = callExpression.arguments;
const url = urlNode.get();
console.time("Fetch");
const response = await fetch(url);
const csvText = await response.text();
console.timeEnd("Fetch");
console.time("Parse");
let rows = Pappa.parse(csvText, { fastMode: true }).data;
console.timeEnd("Parse");
console.time("Render");
const columnIndices = new Array(columns.length);
for (let i = 0; i < columns.length; i++) {
columnIndices[i] = rows[0].indexOf(columns[i]);
}
rows = rows
.slice(Math.max(limit, rows.length) - limit)
.reverse()
.filter((columns) => columns.every(Boolean));
const value = (
<array>
{rows.map((columns) => (
<array>
{columnIndices.map((columnIndex) => (
<string value={columns[columnIndex]} />
))}
</array>
))}
</array>
);
console.timeEnd("Render");
console.timeEnd("fetchCSV Total");
return value;
}

View File

@@ -0,0 +1,23 @@
// macro code
export function matchInFile(callExpression: BunAST.CallExpression) {
const [filePathNode, matcherNode] = callExpression.arguments;
let filePath: string;
filePath = filePathNode.get();
let matcher: RegExp;
matcher = matcherNode.get();
const file: string = Bun.readFile(Bun.cwd + filePath);
return (
<array>
{file
.split("\n")
.map((line) => line.match(matcher))
.filter(Boolean)
.reverse()
.map((line) => (
<string value={line[0]} />
))}
</array>
);
}

10
examples/macros/now.tsx Normal file
View File

@@ -0,0 +1,10 @@
import moment from "moment";
export function now(node) {
var fmt = "HH:mm:ss";
const args = node.arguments;
if (args[0] instanceof <string />) {
fmt = args[0].get();
}
const time = moment().format(fmt);
return <string value={time}></string>;
}

View File

@@ -0,0 +1,17 @@
{
"name": "macros",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"moment": "^2.29.1",
"papaparse": "^5.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-refresh": "^0.10.0"
},
"devDependencies": {
"@types/react": "^17.0.24",
"@types/react-dom": "^17.0.9"
}
}

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Macro test</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/styles.css" type="text/css" />
</head>
<body>
<script async type="module" src="/components/index.tsx"></script>
</body>
</html>

View File

@@ -0,0 +1,47 @@
html {
font-size: 4rem;
margin: 0;
padding: 0;
background-color: black;
color: rgb(0, 255, 0);
font-family: "Courier";
}
body {
margin: 48px auto;
text-align: center;
}
.Line {
font-size: 0.5rem;
font-family: monospace;
}
.Table {
display: grid;
width: fit-content;
}
.Row,
.Header {
display: grid;
grid-template-columns: 2fr 1fr 1fr;
text-align: right;
column-gap: 2rem;
}
.Heading {
text-align: right;
}
.Header {
border-bottom: 1px solid rgb(0, 255, 0);
margin-bottom: 20px;
padding-bottom: 20px;
}
.Heading:nth-of-type(2) {
text-align: left;
}

View File

@@ -0,0 +1,7 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {},
"jsx": "preserve"
}
}

View File

@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

42
examples/next/.gitignore vendored Normal file
View File

@@ -0,0 +1,42 @@
# 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
**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun

42
examples/next/.npmignore Normal file
View File

@@ -0,0 +1,42 @@
# 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
**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun

34
examples/next/README.md Normal file
View 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.

View File

@@ -0,0 +1,13 @@
import Hey from "./subtitle";
export default function Title() {
return (
<h1>
Hello <Hey></Hey>
</h1>
);
}
export enum TitleEnum {
wow = 1,
}

View File

@@ -0,0 +1,4 @@
export default function Hey() {
return <div>!!yep</div>;
}

42
examples/next/gitignore Normal file
View File

@@ -0,0 +1,42 @@
# 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
**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun

6
examples/next/next-env.d.ts vendored Normal file
View 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.

View 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,
},
};

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