Commit Graph

131 Commits

Author SHA1 Message Date
Jarred Sumner
6a28cfd2ba [bun dev] Automatically set origin - improve support for proxying Bun
Previously, when running Bun behind a reverse proxy, you had to pass an explicit `--origin` arg and it could only run behind one proxy at a time.

Now, Bun automatically determines the origin from the request if possible. It reads `Forwarded`, `X-Forwarded-Proto`, `X-Forwarded-Host`, `Origin`, and lastly `Host`. If none are available, it falls back to the `--origin` CLI arg.

This change is important for usecases like Replit which shows multiple iframes in different origins.
2022-01-01 18:12:57 -08:00
Jarred SUmner
e4693b8aaf Clear the fd 2022-01-01 03:40:15 -08:00
Jarred SUmner
87e78e2a48 Handle more edgecases 2022-01-01 03:11:36 -08:00
Jarred SUmner
71449c8638 Detect fast refresh from .bun if possible 2022-01-01 02:37:08 -08:00
Jarred SUmner
a17088363f [bun dev] Improve filesystem watcher & HMR reliability (Linux + a little macOS)
Text editors like Replit save through atomic file updates. In an inotify filesystem watcher (Linux), that appears to be a delete followed by moving the file to the directory. Now when known files are moved into a directory, the watcher sends the file change notification to the browser(s). From there, the browser looks at it's files to determine whether or not

Additionally, if an existing HMR connection does not know about a file ID passed to it, it asks the browser to reply with the file path and then starts watching that file. This improves HMR reliabiality if Bun had been restarted but the page hadn't been restarted.
2022-01-01 01:53:50 -08:00
Jarred Sumner
d068d80ab9 Attempt to fix watcher issue with repl.it 2021-12-31 17:52:38 -08:00
Jarred Sumner
eb142a6be5 little test 2021-12-31 15:30:57 -08:00
Jarred Sumner
195723180b [devserver] Log more errors when a websocket connection fails 2021-12-31 15:08:58 -08:00
Jarred Sumner
2e051cebaa Update http.zig 2021-12-31 15:08:19 -08:00
Jarred Sumner
795d0b056c [devserver] Case-insensitive request header comparison, which fixes issues with proxying Bun 2021-12-31 15:08:13 -08:00
Jarred Sumner
6f1c6fbc1a - => . 2021-12-30 22:05:44 -08:00
Jarred Sumner
e75c711c68 Upgrade to latest Zig, remove dependency on patched version of Zig (#96)
* Prepare to upgrade zig

* zig fmt

* AllocGate

* Update data_url.zig

* wip

* few files

* just headers now?

* I think everything works?

* Update mimalloc

* Update hash_map.zig

* Perf improvements to compensate for Allocgate

* Bump

* 📷

* Update bun.lockb

* Less branching

* [js parser] Slightly reduce memory usage

* Update js_parser.zig

* WIP remove unused

* [JS parser] WIP support for `with` keyword

* Remove more dead code

* Fix all the build errors!

* cleanup

* Move `network_thread` up

* Bump peechy

* Update README.md
2021-12-30 21:12:32 -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
143973e031 Fix rare crash when new thread is created, possibly only on musl 2021-12-24 20:44:25 -08:00
Jarred Sumner
e1505d88b1 Prevent crash due to SIGPIPE 2021-12-23 00:43:34 -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
8dcaaa9e09 packaging 2021-12-17 02:43:43 -08:00
Jarred Sumner
e7538d7b26 document failed Link tag experiment in script src 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
b1660fa468 [bun install] async http request works I think? 2021-12-16 19:18:51 -08:00
Jarred Sumner
52f4ba767a [http] Fix bug with Link header 2021-12-16 01:48:31 -08:00
Jarred Sumner
a772b56cb6 [http] Ensure errors from macros can see source code 2021-12-16 00:47:24 -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
cca8081f2e add env var for disabling bun.js SSR 2021-11-21 17:02:21 -08:00
Jarred Sumner
8e0230b756 [router] Tweak sorting order & update routing tests 2021-11-16 16:33:33 -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
bc5f99dc43 [internal] Tiny changes that will eventually make it easier to update zig 2021-11-01 04:04:18 -07:00
Jarred Sumner
fb10e0c4cb Upgrade checker + polish for bun upgrade 2021-10-28 16:39:26 -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
0592515639 [HTTP Server] Add flag for disabling Bun.js 2021-10-25 17:05:10 -07:00
Jarred Sumner
42c264bf7b Fix all known string encoding bugs 2021-10-25 00:52:07 -07:00
Jarred Sumner
58b196c583 rewrote most of the router 2021-10-20 04:18:29 -07:00
Jarred Sumner
88a5e2d34d Add TLS 1.3 support, improve fetch() HTTPS performance 2021-10-13 00:27:35 -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
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
5370ea71c0 Add support for reading JSX config from tsconfig.json 2021-10-06 16:49:26 -07:00
Jarred Sumner
3b10cfae80 analytics is good enough for now 2021-10-05 23:08:06 -07:00
Jarred Sumner
00e7b7c3d5 Simple analytics 2021-10-05 02:27:49 -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
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
fdda1078f8 Support remapping macro paths 2021-09-30 18:58:39 -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
1a284a1c94 Extremely minor perf improvements 2021-09-22 18:12:18 -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
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
9511bf94d5 Colorize build/resolve errors and add a ^ 2021-09-16 17:37:22 -07:00
Jarred Sumner
b0bb65f494 Big Heap: 2021-09-15 18:07:08 -07:00
Jarred Sumner
bba102c076 Warn when JIT is disabled 2021-09-15 17:04:00 -07:00
Jarred Sumner
5dbbad5cc4 Support installing bun from npm 2021-09-14 16:59:21 -07:00