aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-07-05Fixes #3512 (#3526)Gravatar Jarred Sumner 1-28/+72
* Fixes #3512 * Fix `clearTimeout` and `clearInterval` not cancelling jobs same-tick --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-05Fixes #3520 (#3522)Gravatar Jarred Sumner 1-18/+8
* Fixes #3520 * Update html_rewriter.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-04[tls] fix servername (#3513)Gravatar Ciro Spaciari 1-7/+41
* fix servername * add postgres tls tests * update test packages * add basic CRUD test
2023-07-03Allow zero length WebSocket client & server messages (#3488)Gravatar Jarred Sumner 1-53/+0
* Allow zero length WebSocket client & server messages * Add test * Clean this up a little * Clean up these tests a little * Hopefully fix the test failure in release build * Don't copy into the receive buffer * Less flaky --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-03[tls] add socket parameter, setServername and ALPNprotocols support (#3457)Gravatar Ciro Spaciari 4-63/+547
* add socket parameter support * refactor #socket * add test and more fixs * some fixes * bump uws * handlers fix * more fixes * fix node net and node tls tests * fix duplicate port * fix deinit on CallbackJobs * cleanup * add setImmediate repro * add test to setImmediate * this is necessary? * fix prependOnce on native listener * try to findout the error on nodemailer CI * show error message * Update bun.lockb * prettier * Use exact versions of packages * add alpnProtocol support * update * emit error when connect fails on net.Socket * format * fix _write and cleanup * fixup * fix connect, add alpn test * fix socket.io * add socket parameter to TLSSocket * add TLSSocket socket first parameter * fixup and _start * remove flask tests * fmt --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-02Fixes #3489 (#3490)Gravatar Jarred Sumner 1-27/+8
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-01Use `BunString` in `SystemError` (#3485)Gravatar Jarred Sumner 4-19/+19
* Use `BunString` in SystemError * Use Bun::toStringRef when we will de-ref strings * Move `napi_create_error` to C++ to support `code` being a Symbol potentially * Update blob.zig * Make this test less flaky --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-01Make HTTP Request struct use 8 bytes less memory (#3483)Gravatar Jarred Sumner 1-134/+137
* Make HTTP Request struct use 8 bytes less memory * Update server.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-29Fixes `node:http` and `node:stream` so `ytdl-core` works. (#3452)Gravatar dave caruso 1-2/+1
* fix crash in readablestate * make node:https request+get actually use https * use a native readablestream in IncomingMessage * tweaks * fix abort crash * emit close by default * remove abort. this isnt a real function * add validate functions, fixup some other requested changes. not done yet * Update WebCoreJSBuiltins.cpp * Update JSReadableState.cpp * Add some missing exports --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-25Fixes #3334 (#3401)Gravatar Jarred Sumner 1-34/+63
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-25chore: update lol-html version (#3356)Gravatar BrΓΊnΓ³ Salomon 1-0/+7
* chore: update lol-html version * add tests --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-06-25Support reading embedded files in compiled executables (#3405)Gravatar Jarred Sumner 2-13/+12
* Support reading embedded files in compiled executables * :nail_care: --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-22revamp dotEnv parser (#3347)Gravatar Alex Lam S.L 1-4/+4
- fixes `strings.indexOfAny()` - fixes OOB array access fixes #411 fixes #2823 fixes #3042
2023-06-21upgrade zig to `v0.11.0-dev.3737+9eb008717` (#3374)Gravatar Dylan Conway 9-107/+107
* progress * finish `@memset/@memcpy` update * Update build.zig * change `@enumToInt` to `@intFromEnum` and friends * update zig versions * it was 1 * add link to issue * add `compileError` reminder * fix merge * format * upgrade to llvm 16 * Revert "upgrade to llvm 16" This reverts commit cc930ceb1c5b4db9614a7638596948f704544ab8. --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-20[JSTranspiler] Make `scan` and `scanImports` more careful with GCGravatar Jarred Sumner 1-26/+24
2023-06-18Fix a bunch of bugs (#3352)Gravatar Jarred Sumner 1-4/+4
* Fix a bunch of bugs * undo that one * Fix crash in readdir() * woops * woops * Add comment * :scissors: * Make `readlink()` and `realpath` use much less memory * Update BunString.cpp * woopsie * Unnecessary * Don't commit these --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-14[Bun.serve] fix `Bun.serve` argument check (#3314)Gravatar Ciro Spaciari 2-10/+16
* fixup checks * throw when tls is not a object also fix socket * fix error message * null or undefined on tls option in Bun.serve or sockets should not throw * add tests * fix tests and socket validation * remove unnecessary check * add listen tests
2023-06-14Make `Bun.argv` the same as `process.argv` (#3310)Gravatar Jarred Sumner 1-14/+3
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-13Fix crash in CJS (#3294)bun-v0.6.9Gravatar Jarred Sumner 6-17/+17
* Fix crash in CJS * Add std.heap.ArenaAllocator * Use our arena allocator * Reduce JS parser memory usage and make HMR faster * Write some comments * fix test failure & clean up this code * Update javascript.zig * make arena usage safer --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-11Support using `WTF::StringImpl` from Zig (#3279)Gravatar Jarred Sumner 3-14/+18
* Fix `make headers` * [JS parser] Fix bug with printing non-ascii import paths in ascii mode * Introduce `bun.String` * Add test for non-ascii imports & entry points * Add comment * Fix build issue * Support HTTP server * Make it print the same --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-10Fixes #3250 (#3269)Gravatar Jarred Sumner 1-12/+24
* Fixes #3250 We must call `EVP_MD_CTX_cleanup` because `EVP_MD_CTX` containers pointers inside to allocated memory * Fix leak * Update sha.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-09Fix missing JSC.markBindingGravatar Ashcon Partovi 1-0/+1
2023-06-06Bun.passwordSync -> Bun.password.{method}Sync (#3228)Gravatar Colin McDonnell 1-15/+19
* Bun.passwordSync -> Bun.password.{method}Sync * Update jsdoc * Updates
2023-06-05[Inspector] Introduce `inspector: true` in Bun.serve()Gravatar Jarred Sumner 1-1/+21
This exposes the WebKit inspector debugger protocol over WebSockets at the endpoint `/bun:inspect` when `Bun.serve()`. To enable, pass: ```js Bun.serve({inspector: true, development: true, fetch(req){ /* rest of params *... }); ``` Both `development` and `inspector` must be true, as this is very security sensitive to expose publicly.
2023-06-04Implement `Bun.password` and `Bun.passwordSync` (#3204)Gravatar Jarred Sumner 1-0/+803
* Implement `Bun.password.{verify, hash}` and `Bun.passwordSync.{verify, hash}` * flip the booleans * delete unused * Add `cost` for `"bcrypt"`, add `"memoryCost"` and `"timeCost'` for argon2, use SHA512 * Update bun.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-02use NODE_ENV for react-jsx or react-jsxdev (#3184)Gravatar Dylan Conway 1-1/+0
2023-06-01Rename `ptr` to `_unsafe_ptr_do_not_use` (#3163)Gravatar Jarred Sumner 1-9/+15
* Rename `ptr` to `_unsafe_ptr_do_not_use` * Fixup --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-31[TCP] Ensure we keep the handlers functions alive when an error callback ↡Gravatar Jarred Sumner 1-4/+43
needs to be called This can cause test failures due to GC'ing the handlers when we are *just* about to call them.
2023-05-31Clean-up some option parsing in Bun.spawnGravatar Jarred Sumner 1-5/+16
2023-05-31`--no-macros` flag, disable macros in node_modulesGravatar Jarred Sumner 2-1/+13
2023-05-26Fix crash in `Server.prototype.fetch()` helper functionbun-v0.6.4Gravatar Jarred Sumner 1-3/+9
cc @cirospaciari, if you use `mimalloc-debug` it catches things like this
2023-05-26Fix crash in test.todo + remove JSC C API usages in bun:test (#3079)Gravatar Jarred Sumner 4-8/+8
* Fix crash in test.todo * remove usages of JSC C API in bun:test * Remove additional JSC-C API usages * fix `make headers` * URLSearchParams.length * FormData length * URLSearchParams length * Fix `make headers` * very fancy length * Fix bug with exceptions being ignored sometimes * Add tests for extension toHaveLength --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-24[server.fetch] call when using Request object (#3051)Gravatar Ciro Spaciari 1-13/+9
* patch server.fetch * add tests and fix types
2023-05-24[bun:FileSystemRouter] add more validations on parameters (#3053)Gravatar Ciro Spaciari 1-2/+28
* add validations and allow relative path on dir * remove unneed things * add origin/dir validation tests * remove workaround * add back relative path resolution
2023-05-22[breaking] ServerWebSocket.publish no longer publishes to self by defaultGravatar Jarred Sumner 1-1/+1
This changes `publishToSelf` to be `false` by default instead of `true`. This is a breaking change because it means that `ws.publish("foo", "bar")` will exclude `ws` from the list of websockets to broadcast. We are making this change because many people asked for this and were confused by the status quo - that `w.publish` publishes to self.
2023-05-22[ServerWebSocket] `binaryType` now defaults to `"nodebuffer"`Gravatar Jarred Sumner 1-5/+5
Previously, this defaulted to "uint8array", so this shouldn't be a breaking change unless you make use of `.slice()` in which case it will now be a reference to the same ArrayBuffer rather than a clone. The rationale for this change is most usages of Uint8Array on the server need a little more than just the bytes. Many npm packages expect Buffer rather than Uint8Array. Directly returning it for binary websocket messages is faster than creating another one.
2023-05-21[internal] Even more loggingGravatar Jarred Sumner 1-3/+5
2023-05-21[internal] Use `HiveArray` instead of bespoke memory allocator in Bun.serve()Gravatar Jarred Sumner 1-87/+12
No performance or memory usage change Just removing some duplicate code
2023-05-21[Bun.serve] Support `"nodebuffer"` binaryType in `ServerWebSocket`Gravatar Jarred Sumner 1-28/+17
2023-05-21Add extra flag just to be sureGravatar Jarred Sumner 1-1/+1
2023-05-21fix(tls.connect) fix SNI on tls sockets and also servername (mongodb) (#2934)Gravatar Ciro Spaciari 2-71/+243
* fixes SNI on tls sockets and also servername * πŸ’… * πŸ’… * add support for https and wss * fix bun types * support Bun.file on ca, key and cert * πŸ’… * add setTimeout (makes fastify run) * fix httpVersion * fix WebSocketServer and add listen event * fix ws exports and http listening * fix default import * bump uws * add nodebuffer compatibility * fix drain and allow more passing tests to run * fix enqueud messages * default to arraybuffer * fix constructor binaryType * fmt * fixup * skip some tests * skip more * skip fault tests * reuse encoder instance * fix handshake WS Client * temporary revert handshake fix * fix handshake * disable all socket.io test temp * fixup * add back socket.io tests * use node_fs to read cert, ca and key on server.zig * throw the error returned by NodeFS * πŸ’…
2023-05-20Bun.inspect gets a max depth of 32Gravatar Jarred Sumner 1-0/+1
2023-05-20[internal] Make `JSC.NewFunction` more type safeGravatar Jarred Sumner 1-2/+2
2023-05-17Make `BuildError` and `ResolveError` use C++ instead of JSC C APIGravatar Jarred Sumner 1-2/+2
Fixes memory leak with private data never being cleared Fixes a case where a ResolveError could actually be a BuildError
2023-05-16Fix segfault on passing undefined to bun.build (#2902)Gravatar dave caruso 1-0/+5
2023-05-14fix(spawn) add Uint8Array support for stdout (#2866)Gravatar Ciro Spaciari 1-50/+95
* add array_buffer support for stdout * fix comment * fix param name on baby_list * keep test names consistent * add more test cases
2023-05-14feat(Timer.refresh) add refresh support on Timer (#2874)Gravatar Ciro Spaciari 1-24/+131
* add refresh support on Timer * fix this return * add refresh setTimeout tests * fix tests and add setInterval test * use setCached for arguments and callback --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-05-12`root` bundle option (#2859)Gravatar Dylan Conway 1-0/+31
* handle multiple output files and `[dir]` * get the realpath of `root_dir` * duplicate output paths * add `rootdir` to `JSBundler` * use realpath of input file * add tests for naming and root --------- Co-authored-by: Dave Caruso <me@paperdave.net>
2023-05-11Allow reading config from within plugins, and partially implement esbuild ↡Gravatar dave caruso 1-102/+105
`initialOptions` (#2861) * Implement plugin build.config and initialOptions * update types * default initialoptions entrypoints
2023-05-11Fix `OutputKind`, add "use client" and "use server"Gravatar Jarred Sumner 1-0/+2