aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-03-27Fix for latest zig (#2495)Gravatar Jarred Sumner 1-1/+1
* Fix for latest zig * Revert "Use PATH instead of sudo to install bun for testing (#2460)" This reverts commit 5fd406ca2ffa0cb9c1cb98140bedf0a3ba9e5022. --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-18[fetch] Make the default body value `null` when unspecifiedGravatar Jarred Sumner 1-7/+7
This is better aligned with the fetch spec
2023-03-18Fix crash when rendering error page and the server or network is slowGravatar Jarred Sumner 1-0/+1
2023-03-18Fix several bugs (#2418)Gravatar Dylan Conway 1-0/+3
* utf16 codepoint with replacement character * Fix test failure with `TextEncoder("ascii')` * Add missing type * Fix Response.prototype.bodyUsed and Request.prototype.bodyUsed * Fix bug with scrypt error not clearing * Update server.zig * oopsie
2023-03-15Fix socket tests with connection errors (#2403)Gravatar Dylan Conway 1-0/+2
* release pending activity with connection error handler * unref poll_ref
2023-03-15allows Bun.serve to listen on IPV6 (#2400)Gravatar Ciro Spaciari 1-26/+63
2023-03-14Fix text formatting in .remoteAddress in `ServerWebSocket` and `Socket`Gravatar Jarred Sumner 2-14/+23
Fixes #2387
2023-03-13feat(net.createServer) and adds socket.connect IPC support (#2337)Gravatar Ciro Spaciari 1-5/+17
* added net.Server * fix fmt * fix cast and move test * fix node-net.tests.ts but breaks server data receive * fix end and close only emitting when data or pipe was added * fix socket starting paused * add echo test * fix fmt * fix fmt * on close if the socket is paused, keep paused until the user resumes it to match node behavior * resume on connect * fix getConnections, error on close, make _Handler private and create symbols for SocketServerHandlers * add path support (IPC) * fix unix domains support, add connect unix tests * fix unix socket tests * emit listening and listening error on next tick * fix connection flask test * try fix connect error on macos test * merge connection and drop tests * added exclusive option * fix socket.zig fmt * fix validation for options and add test for it * pass prettier fmt
2023-03-08More spec compliant `Blob.prototype.type` (#2340)Gravatar Jarred Sumner 1-1/+3
* Make `Blob.prototype. type` more spec compliant * Add a few more checks for isNumber() * Fix `make headers` * Safer JSValue.isString() * More tests for blob.slice * Make `Blob.prototype.type` more spec compliant * Add isASCII check * Fix types * Fix failing type test * Update blob.zig * Update blob.zig * Fix .eql check on empty values --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-02Add a zig fmt action (#2277)Gravatar Jarred Sumner 1-1/+1
* Add a zig fmt action * add failing file * Setup prettier better * Update prettier-fmt.yml * Fail on error * Update prettier-fmt.yml * boop * boop2 * tar.gz * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * boop * Update prettier-fmt.yml * tag * newlines * multiline * fixup * Update zig-fmt.yml * update it * fixup * both * w * Update prettier-fmt.yml * prettier all the things * Update package.json * zig fmt * ❌ ✅ * bump * . * quotes * fix prettier ignore * once more * Update prettier-fmt.yml * Update fallback.ts * consistentcy --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-03-02put AbortSignal in WebCore namespace (#2267)Gravatar Ciro Spaciari 1-3/+3
2023-03-02only free sink after promises solves (#2268)Gravatar Ciro Spaciari 1-9/+9
2023-03-02Fix `Bun.sleepSync` to actually use milliseconds (#2242)Gravatar Justin Whear 1-4/+24
* Fix Bun.sleep/sleepSync to actually use milliseconds `Bun.sleepSync` was accidentally treating its argument as seconds rather than milliseconds as the docs stated. This is a breaking change in that the function now behaves as documented. Fixed relevant tests. * sleepSync: add more argument checking, tests
2023-03-01fix bun server segfault with abortsignal (#2261)Gravatar Ciro Spaciari 1-23/+78
* removed redundant tests, fixed server segfault * fix onRejectStream, safer unassign signal * fix abort Bun.serve signal.addEventListener on async * move ctx.signal null check up * keep original behavior of streams onAborted
2023-03-01avoids segfault after aborted onReject in Bun.serve streams (#2256)Gravatar Ciro Spaciari 1-7/+8
* avoids segfault after aborted on reject * silence err on handleRejectStream after aborted
2023-03-01Revert spawnSync changeGravatar Jarred Sumner 1-1/+2
cc @FireTheFox
2023-03-01fix deinit behavior when connection is aborted using ResponseStream and ↵Gravatar Ciro Spaciari 1-33/+59
abort event behavior (#2252) * fix deinit behavior when connection is aborted using ResponseStream * fix abort handling on stream, and get better tests * avoid segfault by trying to deinit 2x when aborted * make tests more reliable * more reliable onResolveStream after aborted * add test case for not firing the abort signal
2023-02-28Don't tick the event loop in spawnSyncGravatar Jarred Sumner 1-3/+1
2023-02-25Faster `eqlCaseInsensitiveASCII`Gravatar Jarred Sumner 1-7/+1
2023-02-25Call BoringSSL.load() in more placesGravatar Jarred Sumner 1-0/+2
2023-02-24Fix lol_html_rewriter_builder_add_document_content_handlers binding (#2161)Gravatar Justin Whear 1-3/+2
The `lol_html_rewriter_builder_add_document_content_handlers` does not return a status code and always succeeds; errors are reported on subsequent calls to `write` or `end`. Fixes #2024
2023-02-23Upgrade Zig (#2151)Gravatar Dylan Conway 7-46/+49
* fixup * Upgrade Zig * Remove bad assertion * strings * bump * mode -> optimize * optimize * Linux build * Update bindgen.zig
2023-02-22feat(Request.signal) Initial support for signal in Request + fetch and ↵Gravatar Ciro Spaciari 1-1/+17
Request + Bun.serve (#2097) * add fetch abort signal * get aborted (still segfaults) * bidings.zig u0 error * still GC/memory error * fix start crash * fix AbortSignal fromJS * change fromJS to obj.as * addAbortSignalEventListenner * handle abort types, and add tests * fix tests * add custom reason test * merge 2 substring methods, use MAKE_STATIC_STRING_IMPL * fix create AbortError and TimeoutError, move globalThis and exception creation to main thread * fix tests and rebuild headers * no need to check with substring reason is already an exception * no need to check with substring reason is already an exception * fix dumb error inverting conditions for check reason * fix custom reason behavior * Request signal * remove package-lock.json * Remove JSC.Strong from Request signal * fix globals for fetch abort signal * more tests, clone signal crashs * fix AbortSignal.toJS * fix toJS bidings for AbortSignal * add streaming tests * fix abortion before connecting * fix tests and segfault * add fetch testing abort after finish * fix signal handler cleanup * support signal event Bun.serve * pull tests (failing) * remove unsupported test * formating * fix server Request.signal, fix cleanNativeBindings * add direct tests * more pull tests * fix stream tests * fix fetch, pending onAborted fix in HTTPServerWritable --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-02-22[breaking] Return Node.js `Timeout` objects in `setTimeout`, `setInterval`, ↵Gravatar Jarred Sumner 1-31/+111
and `setImmediate` Fixes #2129 #880
2023-02-22format options with quote strings (#2134)Gravatar Dylan Conway 1-4/+5
2023-02-22wiptest -> test (#2131)Gravatar Dylan Conway 1-1/+0
* +/- for object diff, quote more strings * wiptest -> test * quote strings fix
2023-02-21Update test runner output with colors and diffs (#2122)Gravatar Dylan Conway 1-0/+2
* add zig-diff * move diff functions * toHaveProperty diff for objects * use formatter * format labels * move work to format, diff when it makes sense * remove comptime, dim equal slices * order before diff * line diffs * add diffz * switch to diffz * add `diffLines()` function * small `prettyFmt()` bug fix * test runner color output * update `toBe()` error output * fix test * diff method, fix crash * fix link test * remove `isRegex`
2023-02-13Add dynamic port assigning to Bun.serve (#2062)Gravatar Michał Warda 1-5/+2
2023-02-13Implement `FormData` (#2051)Gravatar Jarred Sumner 1-0/+1
* Backport std::forward change * Implement `FormData` * Fix io_darwin headers issue * Implement `Blob` support in FormData * Add test for file upload * Fix bug with Blob not reading Content-Type * Finish implementing FormData * Add FormData to types --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-02-06Mark some things as not configurableGravatar Jarred Sumner 5-1/+5
2023-02-03Add test for propagating exceptionGravatar Jarred Sumner 1-1/+1
2023-02-03Introduce `await Bun.sleep(ms)`Gravatar Jarred Sumner 1-13/+19
2023-01-31Re-run prettier after changesGravatar Jarred Sumner 1-11/+2
2023-01-31Handle invalid input in clear* timerGravatar Jarred Sumner 1-2/+6
2023-01-29[breaking] Add `binaryType` option to Bun.connect & Bun.listenGravatar Jarred Sumner 1-4/+18
This is a breaking change because the default is `Buffer`, but previously the default was `Uint8Array`. While `Buffer` is a subclass of `Uint8Array`, it still technically is a breaking change because `slice` in `Uint8Array` is not semantically identical to `slice` in `Buffer` cc @colinhacks, the .d.ts changes I made here aren't great.
2023-01-27fix sentinel mismatchesGravatar Dylan Conway 1-1/+1
2023-01-27ensure name is allocated with `toSliceClone` (#1917)Gravatar Dylan Conway 1-37/+34
* ensure name is allocated with `toSliceClone` * shorten toSliceClone
2023-01-27fix(Express.js) Express.js try to use function as hostname (#1914)Gravatar Ciro Spaciari 1-0/+4
2023-01-26Implement all pending resolve methods in DNS (#1903)Gravatar Ciro Spaciari 1-204/+555
* initial steps to create generic resolve * add soa * add naptr * add naptr * add mx and fix naptr * add resolve caa * fix Caa test * fix toJS from caa * add resolveNs * add resolvePtr * fix resolvePtr test * add resolveCname * add resolve rrtype options (still missing ANY) * fix Naptr * fix drainPendingCares
2023-01-23Update transpiler.zigGravatar Jarred Sumner 1-1/+1
2023-01-23Add a commentGravatar Jarred Sumner 2-9/+6
2023-01-23Upgrade Bun.Transpiler to use new bindingsGravatar Jarred Sumner 3-201/+243
2023-01-22fix unrefOnNextTickGravatar Jarred Sumner 3-15/+4
2023-01-22Add tests for async failureGravatar Jarred Sumner 1-3/+3
2023-01-22[EventEmitter] Preserve `this` in event emitter callbacksGravatar Jarred Sumner 1-2/+2
2023-01-22feat(dns) resolveSrv (#1870)Gravatar Ciro Spaciari 1-4/+362
* initial steps * in-progress resolveSrv support * fix memory leak and ZigGlobalObject * promise.resolve + fix priority and weight mistake * fix node dns export * little better test * add poll_ref to keep alive loop in callback for resolveSrv and lookup * add test for error case in resolveSrc * fix Bun.dns.resolveSrv type
2023-01-21Zig stdlib changeGravatar Jarred Sumner 1-4/+4
2023-01-21Support query string parameters in module resolutionGravatar Jarred Sumner 1-1/+20
2023-01-20one less hash tableGravatar Jarred Sumner 1-2/+13
2023-01-20Fix assertion failure with boringssl messagesGravatar Jarred Sumner 1-1/+1