aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-07-12Make Error.captureStackTrace 4x fasterjarred/faster-error-capturestacktraceGravatar Jarred Sumner 1-0/+2
2023-07-11Fix another crash in Error.captureStackTrace (#3611)bun-v0.6.14Gravatar Jarred Sumner 1-1/+1
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-08Implement `process.on("beforeExit", cb)` and `process.on("exit", cb)` (#3576)Gravatar Jarred Sumner 1-0/+2
* Support `process.on('beforeExit')` and `process.on('exit')` * [bun:sqlite] Always call sqlite3_close on exit * Update process.test.js --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-03Allow zero length WebSocket client & server messages (#3488)Gravatar Jarred Sumner 1-0/+2
* 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-06-25Fix test failures in import.meta (#3403)Gravatar Jarred Sumner 1-2/+4
* Fix test failures in import.meta * regenerate * Use bound functions for `import.meta.require` and `import.meta.require.resolve` and `Module.createRequire` --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-24Rewrite Bun's runtime CommonJS loader (#3379)Gravatar Jarred Sumner 1-4/+5
* wip changes for CommonJS * this rewrite is almost complete * even more code * wip * Remove usages of `import.meta.require` from builtins * Remove usages of require * Regenerate * :scissors: builtin rewrite commonjs in printer * Use lazy custom getters for import.meta * fixups * Remove depd * ugh * still crashing * fixup undici * comment out import.meta.require.resolve temporarily not a real solution but it stops the crashes * Redo import.meta.primordials * Builtins now have a `builtin://` protocol in source origin * Seems to work? * Finsih getting rid of primordials * switcharoo * No more function * just one more bug * Update launch.json * Implement `require.main` * :scissors: * Bump WebKit * Fixup import cycles * Fixup improt cycles * export more things * Implement `createCommonJSModule` builtin * More exports * regenerate * i broke some stuff * some of these tests work now * We lost the encoding * Sort of fix zlib * Sort of fix util * Update events.js * bump * bump * bump * Fix missing export in fs * fix some bugs with builtin esm modules (stream, worker_threads, events). its not perfect yet. * fix some other internal module bugs * oops * fix some extra require default stuff * uncomment this file but it crsahes on my machine * tidy code here * fixup tls exports * make simdutf happier * Add hasPrefix binding * Add test for `require.main` * Fix CommonJS evaluation order race condition * Make node:http load faster * Add missing exports to tls.js * Use the getter * Regenerate builtins * Fix assertion failure in Bun.write() * revamp dotEnv parser (#3347) - fixes `strings.indexOfAny()` - fixes OOB array access fixes #411 fixes #2823 fixes #3042 * fix tests for `expect()` (#3384) - extend test job time-out for `darwin-aarch64` * `expect().resolves` and `expect().rejects` (#3318) * Move expect and snapshots to their own files * expect().resolves and expect().rejects * Fix promise being added to unhandled rejection list * Handle timeouts in expect(<promise>) * wip merge * Fix merge issue --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> * fixup min/memcopy (#3388) * Fix crash in builtins * Don't attempt to evaluate modules with no source code * Update WebCoreJSBuiltins.cpp * Update WebCoreJSBuiltins.cpp * Update WebCoreJSBuiltins.cpp * Fix crash * cleanup * Fix test cc @paperdave * Fixup Undici * Fix issue in node:http * Create util-deprecate.mjs * Fix several bugs * Use the identifier * Support error.code in `util.deprecate` * make the CJs loader slightly more resilient * Update WebCoreJSBuiltins.cpp * Fix macros --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: dave caruso <me@paperdave.net> Co-authored-by: Alex Lam S.L <alexlamsl@gmail.com> Co-authored-by: Ashcon Partovi <ashcon@partovi.net> Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
2023-06-19implement more of V8's stack trace API (#3359)Gravatar Keyhan Vakil 1-1/+1
- fix source map positions for getLineNumber / getColumnNumber - fix return value getting coerced to a string - implement CallFrame.p.toString - add tests for getFunction, getThis, isConstructor, isNative, toString, getLineNumber, getColumnNumber still not implemented: - isPromiseAll/getPromiseIndex - getEvalOrigin - getScriptHash - getPosition - getEnclosingColumnNumber/getEnclosingLineNumber - isAsync - accessing Error.stack should call prepareStackTrace still broken: - isEval: often returns false when it should return true - isToplevel: often returns true when it should return false Refs: https://v8.dev/docs/stack-trace-api Refs: v8/src/objects/call-site-info.cc Fixes: https://github.com/oven-sh/bun/issues/2883
2023-06-15Tweak CommonJS output (#3320)Gravatar Jarred Sumner 1-0/+1
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 1-0/+6
* 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-09Implement mocks in bun:test (#3252)Gravatar Jarred Sumner 1-0/+3
* wip * wip * most of the code for mocks in bun:test * finishing up * Implement `toHaveBeenCalled` and `toHaveBeenCalledTimes(1)` * Test * visit * results, not returnValues * exact * Update jest.zig * A couple more tests * Add jest.fn * support resetting mocks * Implement spyOn --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-06Bun.passwordSync -> Bun.password.{method}Sync (#3228)Gravatar Colin McDonnell 1-2/+0
* Bun.passwordSync -> Bun.password.{method}Sync * Update jsdoc * Updates
2023-06-04Implement `Bun.password` and `Bun.passwordSync` (#3204)Gravatar Jarred Sumner 1-0/+5
* 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-05-29Natively support CommonJS at runtime (#3104)Gravatar Jarred Sumner 1-0/+5
* Natively support CommonJS at runtime * cleanup how getters are handled, add fast path * more consistent with node * use * As * Remove thrown modules on exception * Handle exception better --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-26Fix crash in test.todo + remove JSC C API usages in bun:test (#3079)Gravatar Jarred Sumner 1-0/+4
* 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-24Implement `require.cache` (#3045)Gravatar Jarred Sumner 1-0/+3
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-22Write out builtins with TypeScript + Minify them (#2999)Gravatar dave caruso 1-1/+1
* start work drafting how builtins will work * work on ts builtin * builtins stuff so far * builtins * done for today * continue work * working on it * bindings so far * well, it builds. doesnt run * IT RUNS * still lots of ts errors but it is functional * sloppy mode
2023-05-19[node:vm] Make `vm.runInThisContext` 10x fasterGravatar Jarred Sumner 1-0/+5
2023-05-18Implement `node:vm` (#2785)Gravatar Silver 1-0/+9
* feat: begin implementing node:vm Script object * refactor: clean up and address review comments * refactor: rename Script to VMModuleScript * fix: expose VMModuleScript.prototype also oops I forgot to commit the new files last time * feat(vm): Implement contexts and scripts * feat(vm): implement globalThis * feat(vm): expose node:vm module with global helper functions * refactor(vm): rename VMModuleScript to NodeVMScript * feat: implement script options * doc: add TODOs for runIn*Context options
2023-05-10Clean-up 85b4be5f7189e51e63672ddc874e7c6e09ae8befGravatar Jarred Sumner 1-2/+5
- We don't need to make `Bun__fetch` exported in every C++ header file - We shouldn't return JSObjectRef, its an unnecessary wrapper - The version of `fetch` on the Bun global should be non-configurable so that it is safe for anyone who wants to use that without a user-modifiable one
2023-05-10fix(fetch) fix fetch inheritance (#2842)Gravatar Ciro Spaciari 1-0/+1
* patch fetch function inheritance * fmt * fix reserveCapacity and number of arguments for fetch * change Bun.fetch to use Fetch.jsFunction * merge Fetch.jsFunction and Fetch.call * remove commented code
2023-04-25Implement `onResolve` plugins in `Bun.build()`, support multiple onLoad and ↵Gravatar Jarred Sumner 1-5/+1
onResolve plugins (#2739) * its 2023 * WIP `onResolve` plugins * more progress * it compiles * Lots of small fixes * Seems to work excluding entry points * Update BundlerPluginBuiltins.cpp --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-24Support plugins in `Bun.build` (#2720)Gravatar Jarred Sumner 1-1/+5
* wip * Implement `onLoad` plugins * Support exceptions and async `onLoad` plugins * Fix filtering * Handle empty files * Fix JSON loader --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-13Upgrade WebKit (#2643)Gravatar Jarred Sumner 1-19/+14
* Missing export * Regenerate builtins * Fix crash in require() * Various breaking JSC changes * hopefully speed up C++ compilation a little * Skip failing test fo rnow * Update WebKit * Add a comment * Fix error in postinstall * Update WebKit --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-02-13Implement `FormData` (#2051)Gravatar Jarred Sumner 1-2/+3
* 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-03Introduce `await Bun.sleep(ms)`Gravatar Jarred Sumner 1-0/+3
2023-01-27Make `Bun.dns` lazyGravatar Jarred Sumner 1-0/+3
2023-01-22[EventEmitter] Preserve `this` in event emitter callbacksGravatar Jarred Sumner 1-0/+1
2023-01-17Fix lifetime issue in require.resolveGravatar Jarred Sumner 1-0/+5
2023-01-10attempt (unsuccessfully) to improve c++ build timeGravatar Jarred Sumner 1-114/+1
2023-01-0410x faster `new Buffer` (#1717)Gravatar Jarred Sumner 1-0/+7
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-12-17Delete Oniguruma (#1625)Gravatar Jarred Sumner 1-5/+0
* Update .gitmodules * Delete oniguruma * Delete Oniguruma * Make this test less flaky * :scissors: Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-12-02Add `AbortSignal.timeout`Gravatar Jarred Sumner 1-0/+1
2022-12-013x faster `TextEncoder.prototype.encodeInto`Gravatar Jarred Sumner 1-2/+2
thanks to @Constellation for the tip
2022-11-30Accidentally deleted `prompt` as a result of the process.env changesGravatar Jarred Sumner 1-2/+0
2022-11-29:scissors:Gravatar Jarred Sumner 1-1/+0
2022-11-28Fix process.env and Bun.env object spreadGravatar Jarred Sumner 1-0/+1
Fixes https://github.com/oven-sh/bun/issues/1512
2022-11-19Implement a singleton version of `napi_get_instance_data` and ↵Gravatar Jarred Sumner 1-0/+7
`napi_set_instance_data` Still need to figure out how to do this without adding a layer of indirection to the global object as exposed to NAPI Addons This code is not tested
2022-11-14Fix crash in web crypto. caused by refptrGravatar Jarred Sumner 1-0/+7
2022-11-13Make node streams faster (#1502)Gravatar Jarred Sumner 1-0/+3
* Make node streams faster * Fix for macOS, improve performance, handle ref and unref Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-11-09Error.captureStackTrace implementation (#1476)Gravatar Dylan Conway 1-0/+12
* capture stack trace formatting, tests * fix callsite methods, stack formatting or undefined * isNative, tests for callsite methods * Update src/bun.js/bindings/ZigGlobalObject.cpp * Update src/bun.js/bindings/ZigGlobalObject.cpp * template and macros for visitchildren * static strings, handle infinity and clamp stacktracelimit Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2022-11-07Visit all the fieldsGravatar Jarred Sumner 1-32/+54
2022-11-07Fix missing error in `process.nextTick` and `queueMicrotask`Gravatar Jarred Sumner 1-0/+5
2022-11-03Introduce `import.meta.primordials` for builtin JSGravatar Jarred Sumner 1-0/+3
the `import.meta` object in Bun now has a `primordials` object which makes a handful of globals safe for access. Inside of bun: or node: modules, it is a special object (ownKeys is not implemented, so Object.keys() wont work on it) - Array - String - `isPromise` - `isCallable` - `isConstructable` - `tryGetById(foo, "bar')` which is like foo?.bar - `arrayPush` which is like `Array.prototype.push` - `Bun` - `isAbortSignal` cc @ThatOneBro @lawrencecchen
2022-11-02Fix missing functionsGravatar Jarred Sumner 1-1/+8
2022-10-23Add Web Crypto API (#1384)Gravatar Jarred Sumner 1-1/+8
* Add Web Crypto API * Duplicate symbols * Update c_cpp_properties.json Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-10-17add oniguruma for regex with variable length lookbehinds (#1329)Gravatar Dylan Conway 1-0/+5
* added pcre2 submodule * pcre2 regex boilerplate * tests for pcre2 regex * flag validation, getters, construct and compile mostly working * string escaping for source and toString(), exec, more tests * flag sorting, match, matchAll, search, split, replace * remove lib link * add destructor to PCRE2RegExp * header include * removed ternary * switched to oniguruma for regex library * revert sql changes * fix indices flag, add tests * revert settings * working error messages * more tests for lastIndex, fix logic for compile and lastIndex * move oniguruma lib to deps out dir
2022-10-06Add simple Hot Module Reloading to bun's runtimeGravatar Jarred Sumner 1-0/+3
2022-09-28Clean up some of the event loop codeGravatar Jarred Sumner 1-1/+8
2022-09-22Faster `Blob` + begin to implement `FileSink`Gravatar Jarred Sumner 1-0/+9
2022-09-20meant to include this in the previous commitGravatar Jarred Sumner 1-0/+4