aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-10-31chore: build system improvements (#6811)Gravatar dave caruso 1-0/+0
* build system improvements * public the secret download link * typo * i think i fixed it * fix ci * un-bump the cmake version
2023-10-30Fix memory leak in `require` (#6790)Gravatar Jarred Sumner 8-44/+82
* Fix memory leak in require() and add test * Mark fixtures as generated code * Add optimization for large files * Fix small memory leak --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-30Fix 6281 (#6809)Gravatar Kerem Kat 2-1/+6
* throw an error when `Script` is called without new fix https://github.com/oven-sh/bun/issues/6281 * fix typo in `File` without constructor error fix https://github.com/oven-sh/bun/issues/6281
2023-10-30fix(fetch) (#6672)Gravatar Ciro Spaciari 5-4/+132
* fix fetch * oops * revert * fix checkServerIdentity * check dns len * use same checks on wsclient and fetch, fix tests * more tests and more fixes * fix node-http flask test * orelse * fix requestCert * more fixes, but no data receiving * fix pause on connect behavior on TLS * WS Client + rejectUnauthorized progress * move test to the right place * more test * oops * oops 2 * fmt * cleanup * WIP: handle handshake properly on uWS * handle rejectUnauthorized in uWS * fmt * duplicated test * fix leak * add rejectUnauthorized option in WS types * fix merge * fix merge2
2023-10-30feat(console): add printer for mapiterator (#6778)Gravatar Liz 1-26/+95
* feat(console): add printer for mapiterator MapIterator was not supported in printing, libraries like discordjs make big use of maps and so i think supporting them would be a good idea. * fix: snake case var * fix: add tests for log and add setiterator printer
2023-10-28dx: Fix setup script and contributing docs (#6752)Gravatar dave caruso 1-0/+0
* Updated Dependencies Script * demo * fix submodule hell!!! * lol * attmept 2 * install nasm in ci * setup sh 1 * yeah * better zlib building * codegen stuff * attempt 2 at bun codegen ci * o * deps improvements * generaet part of compile-cpp-only.ps1 * restore these * good enough for Unix * remove libuv submodule lol * pass over docs
2023-10-27fix(ci): typoGravatar dave caruso 1-0/+0
2023-10-27Fix warningGravatar Jarred Sumner 1-3/+6
2023-10-27feat: Windows + CMake Build System (#4410)Gravatar Jarred Sumner 243-49282/+2390
* Prepare for windows event loop * More progress * Update libuv.zig * wip * Make compiling each dependency a shell script * Bump mimalloc * Add the build scripts * Update settings.json * Fix a bunch of compiler warnings * Remove more warnings * more warnings * cmake works * Update JSSQLStatement.h * put it in the zig file * Fix usockets warnings * Fixup * Fix one of the compiler errors * chunk * draw the rest of the owl * theres more * Rename Process -> BunProcess Works around a Windows issue * Add musl polyfill for memmem on Windows * More * 12 mb * Fix getenvZ * fix variosu issues * Add fast-ish path for bun install on Windows * Update windows.zig * Update windows.zig * Fix build issue * it works * hmmm * Rename file * Fixups * Update wtf-bindings.cpp * Update src/bun.js/bindings/headers-handwritten.h Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> * further! * more * Update .gitignore * hm * quite a lot of fixes * Update CMakeLists.txt * zig fmt * Many more things are starting to work. * reb * regenaret * Update JSSink.h * fixup * fetch works * Bun.serve() and much of the event loop works now * Make require() work * bun install progress * more things work * use less std.os * Fixes * small fixes * Bump * Bummp * Undo that change * We have to bump the version of Debian because libarchive has a higher minimum requirement * ok * some clenaup * windows * Update bun.zig * fixup * avoid duplicate symbols * avoid undefined symbols * bump * Remove issue template for install It's not used, and use the bug issue instead. * Add types for cp and cpSync * Add types for watchFile and unwatchFile * Add bun-types to 'bun fmt' script * Update nodejs compat docs cp/cpSync/watchFile/unwatchFile (#4525) * feat(fetch) rejectUnauthorized and checkServerIdentity (#4514) * 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 * churn * Update feature_flags.zig * Update response.zig * Revert "avoid undefined symbols" This reverts commit ca835b726fb5165798de216b20d8e3b3a12571e0. * Revert "avoid duplicate symbols" This reverts commit 4ac6ca87000a157ee4f31308dab60ef8cedb95e4. * Update feature_flags.zig * Set permissions * more * Update mimalloc * Fix sqlite test failures * Fix some test failures * Make sure we remove libusockets is removed * hm * [dave]: fix webcrypto crash * bump * Update index.ts * windows zig compiles * cmake on mac works * progress * yay * bun run build * fix * ok * oops * asdfasfdafdsafda * fghjkl * git ignore * wow * Process -> BunProcess * hmm * blah * finalize merge * now it only has linker errors on mac * sdfadsf * g * getting farther * sxdcvbnmk, * adfhjskfjdhkas * a * fgh * update build dot zig * asdfg * theoretical -DCANARY flag we can use * asdf * cool * okay * colorterm * New build workflow * Fix script * Use sudo * More sudo * Tweak dependencies * Another sudo attempt * Tweak script * 16.0 -> 16 * Tweak script * Tweak script * Tweak script * Tweak script * Tweak script * bun install * ssh into github actions * add more to ssh * Fix postinstal * Skip llvm * New dockerfile * Build * More changes to Dockerfile * chaos chaos chaos * okay * a * more cmake nonsense * add unified sources code (does not work) * stuff * prepare for CI builds * ok * yay * yeah * make this more stable simply by trying again if it fails, 5 times, then lose. it fixes the stability issue i was running into L O L * messing with ci * x * a * clean dependencies before build * oops * this is not going to work but its closer * not gonna work either * a * a * did i do it * a * a * work around weird fs+Bun.build issues * properly pass debug flag correctly * idk im sorry * lose * maybe * run the tests please * a * fix zlib script * a * hi * prevent stupid ci issue * i totally didnt leave in a syntax error on cmakelists * a * lol * relax * 😭 * a * SO SILLY * 😡 one line mistake * one character diff * fix linking symbols missing * work on dependency scripts * does this work now? * fix mac build * a * bump! * woops * add macos baseline build * . * fix sqlite and also enable $assert/$debug support in builtin functions * okay * oops * zig upgrade lol * Merge * Fix spawn test issue * Set a timeout * yeah * etc * mi --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com> Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> Co-authored-by: Ashcon Partovi <ashcon@partovi.net> Co-authored-by: Birk Skyum <74932975+birkskyum@users.noreply.github.com> Co-authored-by: dave caruso <me@paperdave.net>
2023-10-27Fix running `Bun.spawn` on Vercel and GCP (#6724)Gravatar Jarred Sumner 5-142/+386
* Fix running `Bun.spawn` on Vercel and GCP * Update subprocess.zig * Deflake test * Update spawn-streaming-stdout.test.ts * Fix tests + cleanup * Fix hang * Handle edgecase * Update subprocess.zig * Update subprocess.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-25Add test for custom thenables in AsyncLocalStorage and fix flaky test and ↵Gravatar Jarred Sumner 4-11/+40
make expect(fn).toThrow drain unhandled promise rejections (#6701) * Copy Node.js test for async-local-storage thenables * Fix flaky test * Make expect(fn).toThrow() more reliable * Fix setImmediate order * Support restoring mocked modules with spyOn * Fix vm test * Fix more tests * alright * Upgrade WebKit --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-25Implement `mock.module` in bun:test (#6685)Gravatar Jarred Sumner 14-55/+508
* Implement Module Mocks * Update javascript.zig * Add test for spyOn + ESM namespace * Bump WebKit * Bump WebKit * Drain microtasks at end of test executions --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-25Fix `setTimeout(() => {}, 0)` and align `setImmediate` behavior with Node.js ↵Gravatar Jarred Sumner 4-15/+113
(#6674) * Fix setTimeout(() => {}, 0) * Align `setImmediate` with Node.js * Update event_loop.zig * Update test * use Bun.sleep --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-24fix(runtime): remove env variable limit (#6697)Gravatar dave caruso 2-8/+20
* fix env limit * test
2023-10-24fix(worker_threads): off by one on threadId (#6671)Gravatar Jérôme Benoit 2-2/+2
* fix(worker_threads): off by one on threadId Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: refine worker_threads threadId consistency test Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: improve worker_threads tests Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: fix worker_threads threadId consistency test Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: simplify worker_threads threadId consistency test Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: refine worker_threads threadId consistency test Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> * refactor: cleanup import on worker_threads tests Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: switch worker_threads worker to TS Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: revert wrong refactoring Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: format Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: port worker_threads worker to ESM Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: cleanup worker_threads test Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: improve worker_threads coverage Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> --------- Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
2023-10-20fix(napi): incorrect refCount with napi_wrap() (#6598)Gravatar chandi Langecker 1-2/+2
while trying to get [`node-usb`](https://github.com/node-usb/node-usb) running with bun, it always failed because close() is only allowed when there are no open references. https://github.com/node-usb/node-usb/blob/7e0182df8cfc684f6ec0cc59691c79731bdb459f/src/node_usb.h#L39-L41 ```c++ inline void ref(){ refs_ = Ref();} inline void unref(){ refs_ = Unref();} inline bool canClose(){return refs_ == 0;} ``` `Ref()` and `Unref()` are both called once, with node.js resulting in `refs_ == 0` (which is expected), but with bun `refs_ == 1`. I've made this small script to reproduce the bug: https://github.com/alangecker/bun-ref-bug/blob/main/binding.cc ``` run with bun 1.0.6: - refcount: 2 (expected: 1) run with node 20.8.1: - refcount: 1 (expected: 1) ``` during a long debugging journey I found out, that buns `NapiRef::ref()` is also just called once (as expected), but within `napi_wrap()` the `NapiRef` gets initialized already with the refCount set to 1 https://github.com/oven-sh/bun/blob/378385ba60900be7bd797923c219ec489101f2f5/src/bun.js/bindings/napi.cpp#L669 ```c++ extern "C" napi_status napi_wrap(napi_env env, napi_value js_object, void* native_object, napi_finalize finalize_cb, void* finalize_hint, napi_ref* result) { // [...] auto* ref = new NapiRef(globalObject, 1); // [...] } ``` After changing it to `new NapiRef(globalObject, 0)` it got the expected behavior / same as with node.js and node-usb works. as far as I understand it, a `NapiRef`` with refCount=0 should then be weak instead of strong, which is why I have changed this too.
2023-10-19Fix missing function names in console.log and Bun.inspect (#6612)Gravatar Jarred Sumner 3-15/+44
* Fix missing function names in Bun.inspect * Fix failing tests * Handle @@toStringTag * Update bindings.cpp * Revert breaking changes to snapshots until a minor version * Fix test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-19fix: support custom file type in Bun.file (#6512)Gravatar Liz 1-1/+32
* fix: support custom file type in Bun.file In the docs it seamed to suggest this is something supported, it seamed to be only supported in JSDOMFiles or blob. This Adds the 2 properties `type` and `lastModified` to be supported on `Bun.file` Fixes: https://github.com/oven-sh/bun/issues/6507 * fix: implement changes requested in review Add changes requested in the review and add a test for a non standard mimetype
2023-10-18fix(node:buffer): fix the behavior of `totalLength` in `Buffer.concat` (#6574)Gravatar Ai Hoshino 1-3/+9
* fix(node:buffer): fix the behavior of `totalLength` in `Buffer.concat` Close: #6570 Close: #3639 * fix buffer totalLength type --------- Co-authored-by: Ashcon Partovi <ashcon@partovi.net>
2023-10-18fix(web): stub `performance.getEntriesByName` (#6542)Gravatar Liz 1-0/+18
2023-10-17Update ZigGeneratedClasses.cppGravatar Dylan Conway 1-2/+0
2023-10-17fix(node:http): fix `server.address()` (#6442)Gravatar Ai Hoshino 5-0/+287
Closes #6413, #5850
2023-10-16fix(runtime): make some things more stable (partial jsc debug build) (#5881)Gravatar dave caruso 60-710/+926
* 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 9-86/+214
* 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(test): when tests run with --only the nested describe blocks `.on… (#5616)Gravatar Igor Shapiro 1-13/+22
2023-10-16fix(sqlite) Insert .all() does not return an array #5872 (#5946)Gravatar Hugo Galan 1-7/+1
* fixing #5872 * removing useless comment
2023-10-16Fix `Response.statusText` (#6151)Gravatar Chris Toshok 7-234/+232
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-16fix(jest): fix toStrictEqual on same URLs (#6528)Gravatar João Alisson 1-13/+10
Fixes #6492
2023-10-16Fix `toHaveBeenCalled` having wrong error signatureGravatar Ashcon Partovi 1-2/+2
Fixes #6527
2023-10-16Fix #6467Gravatar Ashcon Partovi 1-3/+3
2023-10-13fix(error): correct the `path` field in syscall error message. (#6370)Gravatar Ai Hoshino 1-6/+23
* fix(error): correct the `path` field in syscall error message. Close: #6336 * fix pathlike union case
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 4-13/+15
* update build.zig * save * works? * better workaround * fix install * Fix compiler crash
2023-10-12fix(install): re-evaluate overrides when removedbun-v1.0.6Gravatar dave caruso 1-0/+0
2023-10-11Bump WebKitGravatar Jarred Sumner 1-0/+0
2023-10-11Update JSCUSocketsLoopIntegration.cppGravatar Dylan Conway 1-2/+2
2023-10-11feat(install): automatically migrate package-lock.json to bun.lockb (#6352)bun-v1.0.5Gravatar dave caruso 1-1/+19
* work so far * stuff * a * basics work * stuff * yoo * build lockfile * correct * f * a * install fixture havent tested * i made it worse * lol * be more reasonable * make the test easier to pass because bun install doesn't handle obscure lockfile edge cases :/ * a * works now * ok * a * a * cool * nah * fix stuff * l * a * idfk * LAME * prettier errors * does this fix tests? * Add more safety checks to Integrity * Add another check * More careful lifetime handling * Fix linux debugger issue * a * tmp dir and snapshot test --------- Co-authored-by: Jarred SUmner <jarred@jarredsumner.com>
2023-10-10feat(test): implement `toEqualIgnoringWhitespace` (#6293)Gravatar Elad Bezalel 4-0/+116
* feat(test): implement `toEqualIgnoringWhitespace` * equality check in matcher & incorrect arg error
2023-10-10make peer dependencies install by default (#6396)Gravatar Dylan Conway 1-0/+2
* peer dependencies * default true * add test * cleanup * some tests * skip peer deps if they are non optional * remove debug print, fix build * iterate peer dependencies
2023-10-09fix(AbortSignal/fetch) fix AbortSignal.timeout, fetch lock behavior and ↵Gravatar Ciro Spaciari 9-23/+50
fetch errors (#6390) * fix abort signal and fetch error * fix fetch error and lock behavior
2023-10-09fix: support uint8 exit code range (#6303)Gravatar Liz 1-2/+2
The exit code support is between 0-255 and not only in the signed positive range (0-127). Node.js does not seam to throw on a bigger integer and just wraps around, but throwing a error is a good approach and makes the behaviour more defined. This allows the range to be 0-255 Fixes: https://github.com/oven-sh/bun/issues/6284
2023-10-07feat(KeyObject) (#5940)Gravatar Ciro Spaciari 23-52/+2567
* 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-05WebCryptoAPI: remove JWK "EdDSA" alg checks (#6294)Gravatar Filip Skokan 1-2/+0
2023-10-04fix os test failureGravatar Dylan Conway 1-0/+3
2023-10-04Create `AbortSignal` without JS (#6278)Gravatar Jarred Sumner 4-15/+24
* Create `AbortSignal` without JS * Don't leak --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-10-03Upgrade webkit (#6277)Gravatar Dylan Conway 4-10/+14
* `reportExtraMemoryAllocated` parameters changed * bump webkit * Update Dockerfile * format
2023-10-03compat: Buffer: allow optional positional arguments to be undefined (#4911)Gravatar Andrey Smirnov 1-14/+51
* fix `Buffer` compat with Node.js: compare * fix `Buffer` compat with Node.js: copy
2023-10-03fix(blob): Add the current offset to the new blob. (#6259)Gravatar Ai Hoshino 1-1/+2
Close: #6252
2023-10-03feat(encoding): support BOM detection with test passed (#6074)Gravatar WingLim 4-7/+47