aboutsummaryrefslogtreecommitdiff
path: root/src/js/builtins (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-10-09fix(AbortSignal/fetch) fix AbortSignal.timeout, fetch lock behavior and ↵Gravatar Ciro Spaciari 2-0/+10
fetch errors (#6390) * fix abort signal and fetch error * fix fetch error and lock behavior
2023-10-03Update tsconfigsGravatar Colin McDonnell 1-1/+3
2023-09-29Implement virtual module support in `Bun.plugin` (#6167)Gravatar Jarred Sumner 1-0/+3
* Add support for `build.module` in `Bun.plugin` * Another test * Update docs * Update isBuiltinModule.cpp --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2023-09-28Get Next.js Pages Router to work (#6095)Gravatar dave caruso 3-4/+11
* hell * make it so bun-debug-src * teag * wild * yippee * fas * fix async hooks assertions * yap * yeah that's wild * aa * a * increase time allowed * so trivial
2023-09-22fix(runtime): exclude unevaluated module in `require.cache` (#5903)Gravatar Ai Hoshino 1-1/+1
Close: #5898
2023-09-21Implement module.parent (#5889)bun-v1.0.3Gravatar dave caruso 2-18/+6
* Make module.parent work * yay * oops * yay
2023-09-18fix(runtime/node): Allow `new Buffer.alloc()` + Upgrade WebKit (#5699)Gravatar dave caruso 1-0/+3
* make bufferconstructor a static hash table * chore: Upgrade WebKit to 4d995edbc44062b251be638818edcd88d7d14dd7 * make it constructable now * fix comment * yippee * update CI workflows
2023-09-18feat(runtime): Implement `console.Console` (#5448)Gravatar dave caruso 1-0/+760
* prototype * asdfg * It works! * okay its done now fr * self review * ok * fix * fix test --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-09-15feat(runtime): add `process.binding` `uv`/`natives`/`config` + make global ↵Gravatar dave caruso 1-21/+0
object properties lazy (#5355) * binding uv * we did that * some more bindings * fix doc * fix uv * yo * static hash table nonsense <3 * huge refactor to the global object i am not ready for merge conflicts * it works part 3 * lose --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-09-13fix(runtime): make most globals configurable/deletable, allow resuming the ↵Gravatar dave caruso 3-31/+64
console iterator (#5216) * Fix #5177 * Fix #5175 * make most globals deletable/overridable * not done * cool * a * done * fix test * oops * yippee
2023-09-13fix(runtime): require cache should not include unevaluated ESM modules. (#5233)Gravatar dave caruso 1-5/+3
2023-09-10Support named imports for json & toml files at runtime (#4783)Gravatar Jarred Sumner 1-1/+1
* Support named exports in json imports * Support named imports for `*.json` files * Remove stale comments * Don't export arrays as non-default * Add test for default exports * Don't break webpack --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-07Progress for Next.js (#4468)Gravatar dave caruso 1-1/+0
* 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-05Align `process.nextTick` execution order with Node (#4409)Gravatar Jarred Sumner 1-0/+202
* Align `process.nextTick` execution order with Node * some tests * formatting * fixups * fix the test failures * simplify the logic here * push it up --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: dave caruso <me@paperdave.net>
2023-08-23Bunch of streams fixes (#4251)Gravatar Jarred Sumner 1-5/+9
* 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-21fix stdin stream unref and resuming (#4250)Gravatar Dylan Conway 1-11/+17
* fix stream unref and resuming stream * fix `child-process-stdio` test
2023-08-21import errors have `code` set to `ERR_MODULE_NOT_FOUND` and `require` errors ↵Gravatar Jarred Sumner 1-11/+1
have `code` set to `MODULE_NOT_FOUND` (#4244) * ResolveMessage * Fix it --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-19tty `ReadStream`, `WriteStream`, and readline rawmode (#4179)Gravatar Dylan Conway 2-627/+120
* tty `WriteStream`, `ReadStream`, and rawmode * tests * refactor prototypes * fix failing test * fix test and library usage * more merge * fix child_process test * create pseudo terminal for tty tests * match node logic * handle invalid tty * close descriptors * move tests to another process * fix test again * fix test on linux
2023-08-17Add `util.inspect.custom` support to `util.inspect/Bun.inspect/console.log` ↵Gravatar dave caruso 1-0/+17
(#4194) * start work on util.inspect.custom * asdf * finish util inspect custom inspect * inspect * fix tests * revert * tidy * revert * oops * test * fix issues
2023-08-17Support Nitro (#4098)Gravatar dave caruso 1-1/+11
* Add formatWithOptions * tests and tweaks * adjust * changes * hi * add mark/measure stubs * stuff * allow unix absolute paths here * typo * rebase * fix stats
2023-08-10don't check for trailing slash, var streamGravatar Dylan Conway 1-5/+6
2023-08-10run files without extensions (#4113)Gravatar Dylan Conway 1-6/+24
* run script without extension * process stdio write fix
2023-08-06Bind require.resolve() (#4030)Gravatar Jarred Sumner 1-2/+2
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-02Rewrite built-in modules to use CommonJS over ESM (#3814)Gravatar dave caruso 14-1536/+48
* stfdsafsd sadffdsa stuff finish commonjs stuff asdf not done but work not done but work not done yet but this is how far i am remove files lol update built files uncomment everything in events lol export default stuff * afdsafsd * its not perfect but almost done * okay * cool * remove temp file * finish rebase * revert settings.json * a * ch-ch-ch-ch-changes * okay * remove this check in release for now * sxdcfghnjm, * lkjhgf * fmt * filename can be null * Update NodeModuleModule.h * weee * fmt --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-31Add a test for TransformStreamGravatar Jarred Sumner 2-4/+3
2023-07-27Add `Bun.isMainThread`Gravatar Jarred Sumner 1-1/+1
2023-07-24Merge import.meta.require and require to be the same thing (#3732)Gravatar dave caruso 1-4/+0
* Merge import.meta.require and require to be the same thing * support `require` and BunPlugin (runtime plugin) * plugins * unused code * revert launch.json
2023-07-23Upgrade WebKit (#3777)Gravatar Jarred Sumner 13-113/+114
* Upgrade to latest WebKit * Upgrade WebKit * hm * Fix failing tests * Delete utf8-encoding-fixture.bin.cmp --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-20Fix builtins again (#3713)Gravatar dave caruso 1-1/+1
2023-07-20fix process.binding (#3711)Gravatar dave caruso 1-4/+3
2023-07-19Support streams in response.formData() & request.formData, introduce ↵Gravatar Jarred Sumner 1-0/+10
Bun.readableStreamToFormData() (#3697) * codegen * FormData.from * Fixes #3225 * Introduce `Bun.readableStreamToFormData` * Update bun.d.ts * Add examples * add --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-19Fix vite (#3694)Gravatar dave caruso 1-6/+1
* Fix ServerWebSocket.readyState * Add create_hash_table to our repo * Fix #3216
2023-07-19Implement `AsyncLocalStorage` (#3089)Gravatar dave caruso 4-8/+62
* work to get async local storage working. * a * a * everything but queueMicrotask * sdfghj * . * finish * tests * test * ok * done * im so stupid * Upgrade WebKit * refactor * refactor * changes requested * oops * cool * fix runInAsyncScope
2023-07-17Implement `process.{stdout, stderr}.{columns, rows, getWindowSize}`Gravatar Jarred Sumner 1-28/+51
2023-07-13Fixes #3629Gravatar Jarred Sumner 1-5/+5
2023-07-12Improve our internal typedefs (#3608)Gravatar dave caruso 4-11/+20
* types * some more * yeah * i think that fixes it * oop
2023-07-09Implement nearly all of `process` object methods and properties (#3581)Gravatar Jarred Sumner 2-6/+46
* Add special case * Make process object load faster * Fix openStdin --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-07Update types, partially fix `typecheck` (#3551)Gravatar Colin McDonnell 8-8/+17
* Update types * Remove caret
2023-07-05Fixes #3515 (#3523)Gravatar Jarred Sumner 1-0/+4
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-01[WIP]Fix calling `Buffer.toString` with `(offset, length, encoding)` (#3467)Gravatar Ai Hoshino 1-16/+16
* Allow `toString` to be called with `(offset, length, encoding)`. Close: #3085 * handle undefined value * add tests for buffer.xxxSlice * fix parameters * fix offset and length
2023-06-29Fixes `node:http` and `node:stream` so `ytdl-core` works. (#3452)Gravatar dave caruso 2-5/+5
* 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-27don't overwrite `__esModule`Gravatar Dylan Conway 1-0/+4
2023-06-27add `__esModule`Gravatar Dylan Conway 1-2/+4
2023-06-26Runtime support for `__esModule` annotations (#3393)Gravatar Jarred Sumner 1-3/+4
* Runtime support for `__esModule` annotations * Ignore `__esModule` annotation when `"type": "module"` is set --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-25Fix test failures in import.meta (#3403)Gravatar Jarred Sumner 2-11/+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 5-128/+210
* 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-17[eventsource] SSE Client (#3074)Gravatar Ciro Spaciari 1-0/+500
* fix flush * remove logs * add HTTP/1.1 eventsource * fix parse spec * multiple data in one event * get lastEventId for reconnection * fix parsing add reconnect * fix reconnection retry * add retry option * move eventsource to builtins * remove duplicate interface on globals.d.ts * move test to TS * fmt * allow no Content-Length or Transfer Encoding * udpate builtins * hardcoded * merge * revert /src/out * updated * Update .gitignore * Make the tests fail * Cleanup EventSource getter * fixup * fixup TS * fmt * update builtins * fix tests * Clear existing timeouts * Add `ref` and `unref` methods * Use `super` to make prototype pollution slightly harder * Reduce test timeout * Regenerate builtins * prettier + ref/unref * Outdated * forgot to commit this --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-02fix readableStreamToArrayBuffer (#3181)Gravatar dave caruso 1-4/+6
* fix discord.js again * remove one of the async hooks warnings * clarify hardcoded modules docs
2023-06-02Fixes #3161 (#3174)Gravatar Jarred Sumner 1-2/+9
* Fixes #3161 * Fix the error message * woops --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-01Bundle and minify `.exports.js` files. (#3036)Gravatar dave caruso 31-0/+8780
* move all exports.js into src/js * finalize the sort of this * and it works * add test.ts to gitignore * okay * convert some to ts just to show * finish up * fixup makefile * minify syntax in dev * finish rebase * dont minify all modules * merge * finish rebase merge * flaky test that hangs