aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/modules (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-10-16fix(runtime): make some things more stable (partial jsc debug build) (#5881)Gravatar dave caruso 4-350/+422
* 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-09-29Implement virtual module support in `Bun.plugin` (#6167)Gravatar Jarred Sumner 1-13/+4
* 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 1-2/+42
* 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-27Complete rework of the majority of `node:util`, primarily `util.inspect` (#4493)Gravatar jhmaster 1-1/+4
* 1st revision of new util.inspect impl. (not done) * fix util.types.isArrayBuffer * fix some utl tests and bugs * fix node:tty missing primordials * fix utl stackoverflow handling & some tests * narrow down diff. context test * util.inspect indirect circulars optimization * temp workaround for buggy is...Function checks * impl. Map/Set/Iterator entries inspection * fix bigint & symbol objects inspection * error inspection fixes * misc util tests stuff * inline getExternalValue stub * leftovers * util.inspect promise internals * run bun fmt * commit make js changes * cut out unnecessary utl files * reorganize utl folder structure * remove browserify buffer check * Try to revert git messing up uws somehow This reverts commit 2c27e16e7d361657b9c3a7dc7892117cf31e15ee. * commit src/js/out files again * redo this edit too * refresh js/out files * Removed uws submodule * tidy up * unused primordials * run fmt --------- Co-authored-by: dave caruso <me@paperdave.net>
2023-09-25Add Module._extensions (#5998)Gravatar Jarred Sumner 1-2/+7
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-09-15feat(runtime): add `process.binding` `uv`/`natives`/`config` + make global ↵Gravatar dave caruso 1-1/+1
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-10Support named imports for json & toml files at runtime (#4783)Gravatar Jarred Sumner 2-1/+84
* 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-2/+42
* 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-08-30Fix bug in `util/types`.{isGeneratorFunction,isAsyncFunction}Gravatar Jarred Sumner 1-4/+24
2023-08-21Implement FileGravatar Jarred Sumner 1-4/+3
2023-08-19tty `ReadStream`, `WriteStream`, and readline rawmode (#4179)Gravatar Dylan Conway 1-1/+0
* 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-08Set exports to {} in user-constructed CommonJSModuleRecords (#4076)Gravatar dave caruso 1-0/+4
2023-08-08Fix require("console") #3820 (#4073)Gravatar dave caruso 1-2/+4
* Fix #3820 * Add Module (#4074)
2023-08-08import bun (#4055)Gravatar Jarred Sumner 3-0/+33
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-06Code coverage for `bun test` (#3975)Gravatar Jarred Sumner 1-1/+59
* WIP code coverage initial commit * almost works * one approach * Code Coverage * Update WebKit * it works but is not yet accurate * skip double ascii check * wrapper * it works but i'm not sure what to do about blocks * hide blocks for now * Update ZigSourceProvider.cpp * Create coverage.md * Update nav.ts --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-08-03Implement Module.wrap()Gravatar Jarred Sumner 1-23/+45
2023-08-03Bunch of fixes (#3516)Gravatar Ashcon Partovi 3-4/+27
* Fix #3497 * Fix #3497 * Run prettier * Fix package.json * remove this too * yeah * Fix missing tests * Use native for utf-8-validate * Add module ID names to builtins * Defer evaluation of ESM & CJS modules until link time * Use builtin name for exports in plugins * Add module IDs to builtins * Update JSC build with new flag * WebKit upgrade fixes * Update WebKit * prettier * Upgrade WebKit * bump * Update once again * Add visitAdditionalChildren, remove .fill() usage * Update process.test.js * Update fs.test.ts --------- Co-authored-by: dave caruso <me@paperdave.net> 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-811/+2516
* 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-24Merge import.meta.require and require to be the same thing (#3732)Gravatar dave caruso 1-3/+3
* 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-22Fixes #3744Gravatar Jarred Sumner 1-15/+125
2023-07-19move constants module to cpp (#3683)Gravatar Ciro Spaciari 1-0/+262
2023-07-09Implement nearly all of `process` object methods and properties (#3581)Gravatar Jarred Sumner 1-0/+8
* Add special case * Make process object load faster * Fix openStdin --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-02[node:buffer] Implement `isUtf8` and `isAscii` (#3498)Gravatar Jarred Sumner 1-0/+130
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-06-27Update NodeModuleModule.cppGravatar Jarred Sumner 1-2/+5
2023-06-26Fix default export of `"module"` modulebun-v0.6.10Gravatar Jarred Sumner 1-46/+56
2023-06-26webpack test and add empty `prototype` prop to module (#3421)Gravatar Dylan Conway 1-3/+6
2023-06-26implement `_nodeModulePaths` and `require.main.paths` (#3411)Gravatar Dylan Conway 1-11/+4
* tests in progress * add `require.main.paths`, add every dir up to root * remove imports
2023-06-25Fix test failures in import.meta (#3403)Gravatar Jarred Sumner 1-17/+6
* 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 4-30/+36
* 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-04-13Upgrade WebKit (#2643)Gravatar Jarred Sumner 1-1/+1
* 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-12Set `require("module").globalPaths` to empty arrayGravatar Jarred Sumner 1-0/+3
https://github.com/oven-sh/bun/issues/1641#issuecomment-1427017442
2023-01-16Add missing `buffer` module exportsGravatar Jarred Sumner 1-13/+79
2023-01-11`require.resolve` in the runtime should use CommonJS export conditionsGravatar Jarred Sumner 1-28/+16
2023-01-0410x faster `new Buffer` (#1717)Gravatar Jarred Sumner 1-4/+2
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-12-02[node:event] Add `captureRejectionSymbol`Gravatar Jarred Sumner 1-0/+4
2022-11-16Mark some more commonjs modulesGravatar Jarred Sumner 2-7/+34
2022-09-28Support a `default` object in CommonJS wrapperGravatar Jarred Sumner 1-0/+18
Fixes https://github.com/oven-sh/bun/issues/1284 Related to https://github.com/oven-sh/bun/issues/1285
2022-09-25Implement `isatty` in `node:tty`Gravatar Jarred Sumner 1-0/+69
2022-09-06Fix issue with `process` esm node exportGravatar Jarred Sumner 1-31/+68
2022-09-06Add missing `Blob`Gravatar Jarred Sumner 1-2/+2
2022-09-05Support async `onLoad` callbacks in `Bun.plugin`Gravatar Jarred Sumner 2-47/+69
2022-09-05Move `generateObjectModuleSourceCode` to separate file to fix build errorGravatar Jarred Sumner 2-24/+31
2022-09-05`inline`Gravatar Jarred Sumner 1-1/+1
2022-09-05Missing #pragma onceGravatar Jarred Sumner 1-0/+2
2022-09-04`[node:module]` Implement `_resolveFileName`, stub `_nodeModulePaths` & `_cache`Gravatar Jarred Sumner 1-3/+63
Closes https://github.com/oven-sh/bun/issues/1111
2022-09-03Fix `createRequire()` in `node:module`Gravatar Jarred Sumner 2-0/+150
Fixes https://github.com/oven-sh/bun/issues/831 Fixes https://github.com/oven-sh/bun/issues/453
2022-09-03Fix build errorGravatar Jarred Sumner 1-6/+5
2022-09-03Plugin API (#1199)Gravatar Jarred Sumner 1-0/+32
* Plugin API * Fix the bugs * Implement `"object"` loader Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-09-01Add native StringDecoder (#1188)Gravatar Zilin Zhu 1-0/+15
* Add native StringDecoder * fix upon reviews * add Constructor and use LazyClassStructure
2022-08-23add SlowBuffer (#1133)Gravatar Zilin Zhu 1-0/+6