aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api (follow)
AgeCommit message (Collapse)AuthorFilesLines
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
2023-05-11bundler tests and improve `Bun.build` return type (#2833)Gravatar dave caruso 2-1/+13
* importstar_ts * tests * run acorn test suite * bench tweaks * test * bun.build tests very incomplete * remove dataurl and base64 loaders from tests since they dont work yet * tests * stuff * stuff * add errors and array of blobs * work so far * docs * requested changes * fix overwrite docs * remove this file
2023-05-10fix(fetch) fix fetch inheritance (#2842)Gravatar Ciro Spaciari 1-3/+3
* 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-05-10Implement `BuildArtifact`Gravatar Jarred Sumner 2-0/+253
2023-05-08Fix memory issues with `loader` and `define` in JSBundlerGravatar Jarred Sumner 1-42/+42
2023-05-08implement build api `define` and `loaders` (#2805)Gravatar dave caruso 2-15/+100
* parse error logs * clean up types * remove --jsx-production. use NODE_ENV instead * add define to js api * add loaders to js api * fixups * sourcemap * typo fix * remove label, comment dir just for now * test tweaks * test work * make optional enums actually optional. allows `sourcemap: undefined` * overload host ram test * string tests * tests * test for 2815 * requested changes * sort this list * remove this test file now that it passes * oops * add --format * finish ts tests * doc typos related to define and loader
2023-05-08added some improvements on server (#2803)Gravatar Ciro Spaciari 1-136/+236
* added some improvements on server * undo unintended change * clean data handler before end calls * refactor * make ctx.resp nullable --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-05-07Add tracy (#2817)Gravatar Jarred Sumner 1-0/+9
* Add tracy * RTLD * Linux needs LD_PRELOAD * More tracing * Inline this --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-05-06Fix `make headers`Gravatar Jarred Sumner 1-0/+5
2023-05-06Fix `make headers`Gravatar Jarred Sumner 1-0/+3
2023-05-06Fix a memory leakGravatar Jarred Sumner 1-0/+1
2023-05-06Use `isFile()` helperGravatar Jarred Sumner 1-1/+1
2023-04-30Implement source maps (#2770)Gravatar Dylan Conway 1-1/+1
* wip * Begin computing source map tables * source map progress * external source maps * fix merge * remove `@as` coercion * inline source maps and output source map shifts * fix `codeWithSourceMapShifts()` after merge * remove second call to `findReachableFiles()` * use `worker.allocator`, remove comment * don't reuse memory for source and sourceContents * don't reuse `quote_buf` * fix writing to stdout * Add comment * Don't include a sourcemap if the text was empty * Make the parser faster * +16% faster sourcemap generation @dylan-conway I'll need you to look this over to make sure I didn't mess anything up Though it currently doesn't generate the offsets in the right order... * 30% performance improvement to Bun.build() * Print `debugId` in source maps cc @mitsuhiko @notzeeg --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-28bundler tests: rest of default.test.ts and starting jsx tests (#2765)Gravatar dave caruso 2-13/+13
2023-04-28fix several memory issues related to pluginsGravatar Jarred Sumner 1-2/+5
2023-04-28Improves Body.Value life cycle and Signal life cycle on server.zig (#2752)Gravatar Ciro Spaciari 2-168/+122
* reestruct request body value and signal * revert react-hello-world * fix constructInto and test * fmt * fix body nullable * Request can outlive RequestContext * fmt * BodyValue is now HiveRef * hasDecl for Ref and HiveRef * fix deinit call on Ref/HiveRef * adds InlineBlob * fix Bun.inspect when using InlineBlob * revert InlineBlob * Fix mimalloc-debug * Add TODO note * fix: make node:crypto Hash.copy work correctly (#2761) This commit will also: - add a CryptoHasher.copy function - make CryptoHasher.digest reset the hasher so it can be reused Resolves #2651 * :nail_care: * address unicode issue (#2763) * Fix an oopsie * Another oopsie * use inline for * Fixup --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> * Request can outlive RequestContext * fmt * garantee to have the abort signnal attached to the server before abort the client on bun-server test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Silver <14016168+silversquirl@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-04-28Bundler docs updates + support for `naming` string (#2767)Gravatar Colin McDonnell 1-15/+26
* Bundler docs updates * Remove comments * Updates * Fix bunx usages * Add info about metafile
2023-04-27fix: make node:crypto Hash.copy work correctly (#2761)Gravatar Silver 2-3/+31
This commit will also: - add a CryptoHasher.copy function - make CryptoHasher.digest reset the hasher so it can be reused Resolves #2651
2023-04-26more esbuild compatGravatar Jarred Sumner 1-7/+8
2023-04-26Implement `file` loader in `Bun.build` (#2745)Gravatar Jarred Sumner 1-0/+18
* Update bundle_v2.zig * Implement `file` loader * Hash in parallel * Implement `publicPath` * simplify * Update bundle_v2.zig * Implement `#!` * Remove unnecessary optional --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-25now it worksGravatar Jarred Sumner 1-2/+2
2023-04-25Implement `onResolve` plugins in `Bun.build()`, support multiple onLoad and ↵Gravatar Jarred Sumner 1-121/+213
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-36/+408
* 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-22Make `Bun.build` more reliable (#2718)Gravatar Jarred Sumner 1-2/+2
* One possible implementation to make `Bun.build` work better * Pass allocator in * Make our temporary buffers a little safer * rename * Fix memory corruption in symbol table * Add support for deferred idle events in ThreadPool * Free more memory * Use a global allocator FS cache * more `inline` * Make duping keys optional in StringMap * Close file handles more often * Update router.zig * wip possibly delete this commit * Fix memory issues and reduce memory usage * > 0.8 * Switch to AsyncIO.Waker and fix memory leak in JSBundleCompletionTask * We don't need to clone this actually * Fix error * Format * Fixup * Fixup --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-04-21Fix `minify: true` not applying to identifiersGravatar Jarred Sumner 1-1/+1
2023-04-21[breaking] In Bun.Transpiler, don't wrap CommonJS modules in `export default`Gravatar Jarred Sumner 1-0/+2
2023-04-21Add `minify` option to Bun.TranspilerGravatar Jarred Sumner 1-0/+30
2023-04-21`Bun.build()` partial implementationGravatar Jarred Sumner 1-7/+35
2023-04-21Add commentGravatar Jarred Sumner 1-0/+2
2023-04-19Fix broken autocompleteGravatar Jarred Sumner 11-124/+124
2023-04-17Fix access of inactive union fieldGravatar Jarred Sumner 1-3/+4
2023-04-17Fixup options parsingGravatar Jarred Sumner 1-22/+48
2023-04-17Prepare for `Bun.build`Gravatar Jarred Sumner 3-82/+20
2023-04-14Update bun.zigGravatar Jarred Sumner 1-1/+1
2023-04-13Only set `is_web_browser_navigation` in debug mode serverGravatar Jarred Sumner 1-8/+16
2023-04-13fix(server) fixes UAF of uWS headers (#2648)Gravatar Ciro Spaciari 1-53/+35
* fixes UAF of uWS headers * fix transfer encoding condition