aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-10-17fix(node:http): fix `server.address()` (#6442)Gravatar Ai Hoshino 2-0/+35
Closes #6413, #5850
2023-10-16fix(runtime): make some things more stable (partial jsc debug build) (#5881)Gravatar dave caruso 1-1/+1
* make our debug assertions work * install bun-webkit-debug * more progress * ok * progress... * more debug build stuff * ok * a * asdfghjkl * fix(runtime): fix bad assertion failure in JSBufferList * ok * stuff * upgrade webkit * Update src/bun.js/bindings/JSDOMWrapperCache.h Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> * fix message for colin's changes * okay * fix cjs prototype * implement mainModule * i think this fixes it all --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-10-16fix(runtime): improve IPC reliability + organization pass on that code (#6475)Gravatar dave caruso 1-19/+13
* dfghj * Handle messages that did not finish * tidy * ok * a * Merge remote-tracking branch 'origin/main' into dave/ipc-fixes * test failures --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-10-16Fix `Response.statusText` (#6151)Gravatar Chris Toshok 2-17/+17
2023-10-16fix-subprocess-argument-missing (#6407)Gravatar Nicolae-Rares Ailincai 1-1/+1
* fix-subprocess-argument-missing * fix-tests * nitpick, these should === not just be undefined --------- Co-authored-by: dave caruso <me@paperdave.net>
2023-10-13Fix dns.lookup returning wrong address for family (#6474)Gravatar Ashcon Partovi 1-3/+4
* Fix #6452 * Fix formatting
2023-10-12Upgrade zig to 0.12.0-dev.888+130227491 (#6471)Gravatar dave caruso 2-11/+13
* update build.zig * save * works? * better workaround * fix install * Fix compiler crash
2023-10-09fix(AbortSignal/fetch) fix AbortSignal.timeout, fetch lock behavior and ↵Gravatar Ciro Spaciari 2-3/+3
fetch errors (#6390) * fix abort signal and fetch error * fix fetch error and lock behavior
2023-10-07feat(KeyObject) (#5940)Gravatar Ciro Spaciari 1-1/+5
* oops * createSecretKey but weird error * use the right prototype, do not add a function called export lol * HMAC JWT export + base64 fix * Fix Equals, Fix Get KeySize, add complete export RSA * fix RSA export * add EC exports * X25519 and ED25519 export + fixes * fix default exports * better asymmetricKeyType * fix private exports * fix symmetricKeySize * createPublicKey validations + refactor * jwt + der fixes * oopsies * add PEM into createPublicKey * cleanup * WIP * bunch of fixes * public from private + private OKP * encrypted keys fixes * oops * fix clear tls error, add some support to jwk and other formats on publicEncrypt/publicDecrypt * more fixes and tests working * more fixes more tests * more clear hmac errors * more tests and fixes * add generateKeyPair * more tests passing, some skips * fix EC key from private * fix OKP JWK * nodejs ignores ext and key_ops on KeyObject.exports * add EC sign verify test * some fixes * add crypto.generateKeyPairSync(type, options) * more fixes and more tests * fix hmac tests * jsonwebtoken tests * oops * oops2 * generated files * revert package.json * vm tests * todos instead of failues * toBunString -> toString * undo simdutf * improvements * unlikely * cleanup * cleanup 2 * oops * move _generateKeyPairSync checks to native
2023-10-04Create `AbortSignal` without JS (#6278)Gravatar Jarred Sumner 1-12/+6
* Create `AbortSignal` without JS * Don't leak --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-02Set `fetch` timeout to 5 minutes (#6217)Gravatar Jarred Sumner 1-2/+13
* Increase timeouts * Update uws.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-29fix(runtime): followup for `server.requestIP` (#6185)Gravatar dave caruso 1-0/+3
* fix(runtime): followup for `server.requestIP` * oops * yeah * sure * Update src/deps/libuwsockets.cpp * Update Dockerfile * lol --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-29fix(resolver): support encoded file urls (#5766)Gravatar dave caruso 1-2/+8
* start working on this * it works now * better implementation imo * yippee * more tests and better unrefing * fix leak?
2023-09-29feat(runtime): implement `server.requestIp` + node:http `socket.address()` ↵Gravatar dave caruso 2-20/+119
(#6165) * [server] requestIp and AnyRequestContext Changed Request.uws_request to the new AnyRequestContext. This allows grabbing the IP from a Request. Unfinished. * [server] basic `requestIp` implementation Currently using uws's requestIpAsText, which always returns a ipv6 string. We should return a `SocketAddress` object to the user instead, which will contain the formatted address string and what type it is. We'll have to use requestIpAsBinary and parse that ourselves. * TypeScript docs, use `bun.String`, return `undefined` instead of `null` if we can't get the ip. * binary address formatting * uws getRemoteAddress binding * remove dead code * working * final touches:sparkles: * I will abide by the results of this poll. --------- Co-authored-by: Parzival-3141 <29632054+Parzival-3141@users.noreply.github.com>
2023-09-28Reduce memory usage of HTTP server (#6135)Gravatar Jarred Sumner 1-1/+2
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-27`deadCodeElimination` toggle for Bun.Transpiler (#5932)Gravatar jhmaster 1-0/+6
* add Bun.Transpiler DCE option * mark DCE toggle experimental + tests * full (hopefully) DCE toggle * update DCE toggle tests * add DCE option to types * run fmt * Removed uws submodule
2023-09-26fix server end of stream, fix fetch not streaming without content-length or ↵Gravatar Ciro Spaciari 1-2/+18
chunked encoding, fix case when stream do not return a promise on pull (#6086)
2023-09-25Drain microtasks at end of abort() if called into JS (#6036)Gravatar Jarred Sumner 1-5/+14
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-20fix(ffi) fix size limit for dlopen (#5516)Gravatar Ciro Spaciari 1-2/+6
* fix size limit * 63 * throw error * ffi.test.js * add macos tests * oops
2023-09-20feat(node:dns): implement `dns.lookupService` (#5613)Gravatar Ai Hoshino 1-4/+302
* feat(node:dns): implement dns.lookupService Close: #4347 * fix flags * add `getSockaddr` * fix sockaddr size * flaky test
2023-09-18Fix HTTP listen behavior being non-compliant with node (#5689)Gravatar dave caruso 1-16/+10
* Fix HTTP listen behavior being non-compliant with node * Add error code for address in use * use SystemError --------- Co-authored-by: SuperAuguste <19855629+SuperAuguste@users.noreply.github.com>
2023-09-16fix(child_process) unref next tick so exit/close event can be fired before ↵Gravatar Ciro Spaciari 1-4/+28
application exits (#5481) * unref next tick so exit callback can be called * fmt + test * oops * add ref_count * update pending * comment and fix
2023-09-14fix(runtime): emit `node:net` connect error event vs throw (#5336)Gravatar dave caruso 1-2/+18
* fix(runtime): emit `node:net` connect error event vs throw * oops * finally * ok * we are good
2023-09-13fix(Bun.serve) fix buffering edge case (#5152)Gravatar Ciro Spaciari 1-2/+3
* fix buffering clean * fix resolveMaybeNeedsTrailingSlash and try to fix ci/cd error * fix resolveMaybeNeedsTrailingSlash and try to fix ci/cd error * oops --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-09-13fix(node:dns): fix the crash. (#5200)Gravatar Ai Hoshino 1-10/+0
2023-09-13Make --watch instant (#5236)Gravatar Jarred Sumner 1-0/+6
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-12Clean up some edgecases with posix_spawn usage (#5079)Gravatar Jarred Sumner 1-19/+57
* Check that the pid matches * Fixup EINTR check * Remove extra slashes * fixup * fixup * != 0 --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-11fix loading env from `.env.production` and friends (#4630)Gravatar Dylan Conway 1-1/+1
* reload conditional vars * test * change `get` and `put` methods * dont clone empty env variables
2023-09-07Progress for Next.js (#4468)Gravatar dave caruso 3-8/+157
* L * ipc * asdfghjkl * dfghjk * it works! * types * patches for next.js * sdfghj * wsdfgn,./ * this * yolo * okay loser * asdfghjk * add some more APIs * MESS * sdfghjkl * remove native events from streams * stuff * remove lazy(primordials) test * debugging * okay * less fake extensions object * fix `Buffer.toString()` args logic * fix deserialize * make tests work * add test for `Buffer.toString` args * Update server.zig * remove test * update test * Update spawn-streaming-stdin.test.ts * fix linux build * Update fs.test.ts * cli message improvements * dfshaj * Fix fs.watch bug maybe? * remove --------- Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2023-09-06feat(fetch) rejectUnauthorized and checkServerIdentity (#4514)Gravatar Ciro Spaciari 2-2/+3
* enable root certs on fetch * rebase * fix lookup * some fixes and improvements * fmt * more fixes * more fixes * check detached onHandshake * fix promise case * fix cert non-Native * add fetch tls tests * more one test
2023-09-04fix(HTMLRewriter) buffer response before transform (#4418)Gravatar Ciro Spaciari 2-54/+114
* html rewriter response buffering * pipe the data when marked as used * fix empty response * add some fetch tests * deinit parent stream * fix decompression * keep byte_reader alive * update builds * remove nonsense * was not nonsense after all * protect tmp ret value from GC, fix readable strong ref deinit/init * fmt * if we detach the stream we cannot update the fetch stream * detach checking source * more tests, progress with javascript and Direct sink * drop support for pure readable stream for now * more fixes --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-09-01fix `Bun.serve` with tls and `Bun.file` (#4450)Gravatar Dylan Conway 1-8/+16
* check sendfile ctx * add test * undo blob check * undo undo and add assert
2023-09-01fix(runtime): fix dns_resolver crash (#4435)Gravatar dave caruso 1-10/+12
* fix incorrect c pointer * format * lets go * random other test case fixed * hanassagi patch * Update dns_resolver.zig * Revert "Update dns_resolver.zig" This reverts commit 53eb338048583a338e7c01d2b351f1c679db3e15. * See if the tests pass --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-08-30reset signal handlers in Bun.spawn (#4405)Gravatar Jarred Sumner 2-8/+35
* see if this fixes it * We don't need this * Remove extra flag --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-29Rename `uws_event_loop` to `event_loop_handle`Gravatar Jarred Sumner 4-12/+12
2023-08-28feat(node:dns): implement `dns.reverse`. (#4332)Gravatar Ai Hoshino 1-3/+281
* feat(node:dns): implement `dns.reverse`. Close: #4299 * fix dns reverse for ipv6 --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-08-28just kernel32 things (#4354)Gravatar Jarred Sumner 10-92/+117
* just kernel32 things * more * Update linux_c.zig * Update windows_c.zig * Add workaround Workaround https://github.com/ziglang/zig/issues/16980 * Rename http.zig to bun_dev_http_server.zig * Rename usages * more * more * more * thanks tigerbeetle * Rename `JSC.Node.Syscall` -> `bun.sys` * more * woops * more! * hmm * it says there are only 37 errors, but that's not true * populate argv * it says 32 errors! * 24 errors * fix regular build * 12 left! * Still 12 left! * more * 2 errors left... * 1 more error * Add link to Tigerbeetle * Fix the remainign error * Fix test timeout * Update syscall.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-27Fix some edge cases in the `env` param of `spawn`. (#4364)Gravatar Ai Hoshino 1-8/+8
Close: #4362
2023-08-25Automatically hot reload Bun.serve() (#4344)Gravatar Jarred Sumner 3-21/+151
* Automatically hot reload Bun.serve() * Update doc * Update example --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-24Listen on a unix domain socket with Bun.serve() (#4311)Gravatar Jarred Sumner 1-50/+149
* Update response.zig * Comment this out for now * Support unix domain socket in Bun.serve() * Add test * add types * Update JSFetchHeaders.cpp * comment this test out * tls unix web socket serve options --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: dave caruso <me@paperdave.net>
2023-08-24Make the server not crash if an error occurs in dev build. (#4300)Gravatar Ai Hoshino 1-5/+5
Close: #4298
2023-08-24update zig to 0.11.0 (#4233)Gravatar Jason 3-7/+7
* WIP * backup * more change * json related error sovled * number related issue solved * revert WriterType changed before * destroy -> free * jsonStringify related issues solved * fix mem.free expected []T or *[_]T, passed [*]const u8 * fix expected []T or *[_]T, passed [*:0]const u8 * fix build script * fix build script, for real * replace 0.11.0-dev.4006+bf827d0b5 to 0.12.0-dev.161+6a5463951 * fix build on macOS, COPYFILE.DATA -> COPYFILE_DATA * fix the last destroy on [*]ptr issue --------- Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2023-08-24Fix performance regression in reading from the request body (#4291)Gravatar Jarred Sumner 1-2/+5
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-24wip (#4282)Gravatar Jarred Sumner 4-5/+44
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-23Bunch of streams fixes (#4251)Gravatar Jarred Sumner 1-108/+187
* Update WebKit * Don't do async hooks things when async hooks are not enabled * Smarter scheduling of event loop tasks with the http server * less exciting approach * Bump WebKit * Another approach * Fix body-stream tests * Fixes #1886 * Fix UAF in fetch body streaming * Missing from commit * Fix leak * Fix the other leak * Fix test * Fix crash * missing duperef * Make this code clearer * Ignore empty chunks * Fixes #3969 * Delete flaky test * Update bun-linux-build.yml * Fix memory issue * fix result body, and .done status before the last callback, dont touch headers after sent once * refactor HTTPClientResult * less flasky corrupted test * oops * fix mutex invalid state * fix onProgressUpdate deinit/unlock * fix onProgressUpdate deinit/unlock * oops * remove verbose * fix posible null use * avoid http null * metadata can still be used onReject after toResponse * dont leak task.http * fix flask tests * less flask close tests --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: cirospaciari <ciro.spaciari@gmail.com>
2023-08-21fetch(stream) add stream support for compressed and uncompressed data (#4127)Gravatar Ciro Spaciari 1-1/+5
* streams non compressed data in 64kb chunks (at least) * fmt * wip remove pause * fix default streaming and buffering * fix atomic lags * fix size * make chunked encoding work again (WIP streaming chunked) * WIP: chunked encoding streaming * fix end of streamings * working streaming + compression * add fixes + tests * fmt + fix proxy * fix oopsies * codegen after merge * fmt + fixes * more fixes * more fixes and logs * avoid double free * check empty before pop * check empty on pop * fix copy to real when complete * remove unnecessary logs * better has_schedule_callback swap, body locked size helper, remove isEmpty from unbounded_queue pop * fix response ref, fix body_size * add deflate support, fix error throw, add more tests * codegen after merge * remove logs, add connection close test * fix macOS build * fix redirect error option * make body_size more clear * support new Reponse(response) * toString DOMWrapper objects properly instead of supporting response in Response constructor * ignore headers with no name, add more tests * oops * handle transform with fetch * add gz image stream test * remove duplicate test * fix missing chunk on macOS under pressure * oops include all OS * some fixes * compare buffers instead of sizes * refactor err.err and protect it
2023-08-21feat: Implement Bun.inspect.custom (#4243)Gravatar dave caruso 1-3/+10
* add Bun.inspect.custom * test * Add Types
2023-08-21Implement FileGravatar Jarred Sumner 1-1/+1
2023-08-18feat: add self-closing & can-have-content (#4206)Gravatar Brúnó Salomon 2-26/+50
2023-08-18Remove most C API usages, add debugger pretty printers for `Headers`, ↵Gravatar Jarred Sumner 10-1591/+938
`URLSearchParams`, `FormData`, `Worker`, `EventTarget` (#4187) * Add pretty printers for `Headers`, `URLSearchParams`, and `FormData` * [untested] Add way to code generate getInternalProperties * bump * Bump Webkit * Ref the event loop while loaded * wip * checkpoint * another checkpoint * The code has been written * Fixup exports * Fix all the errors * Fix bug * [console.log] Fix bug when printing non-reified types missing values * Fix loading hash table * fix plugin * Fix ref & unref * auto-unref * various fixes * Update bun.zig * Set toStringTag * Delete code for macro JSX * Delete code for `bun dev` HTTP JS * Move Bun.serve to C++ API * Delete JSC C API code * :scissors: :skull: code * Use JSC C++ for `confirm`, `Crypto`, `prompt`, `alert` * more dead code * Update exports.zig * Use JSC C++ API for FFI * Remove remaining usages * Remove remaining usages * Update ffi.ts * Update InternalModuleRegistryConstants.h * draw the rest of the owl * Update webcore.zig * bind it * Fix performance regression in crypto.randomUIUD() * Update js_parser.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>