Bun's Roadmap
Jarred-Sumner opened this issue · comments
this has not been updated post Bun 1.0, we will update it soon.
This tracks the current near-term plans for Bun.
Edge bundling
With bundle-time functions, static analysis goes dynamic. Objects returned by functions executed at bundle-time are injected into the AST. This makes dead-code elimination work a lot better.
I expect this to spawn a new generation of bundle-time JavaScript frameworks.
But first, a lot more needs to be built.
Main blockers
JavaScript minifier
- Minify JavaScript identifier names
- Compress JavaScript syntax (this is partially implemented)
- Constant folding
- Dead code elimination (this is partially implemented)
- Read
"sideEffects"
from package.json
Web Bundler (production-focused, instead of development-focused)):
- Tree-shaking
- Source maps
- Source maps for JavaScript (exists today without bundling)
- Source maps for CSS
- Input source maps
- Code splitting (esm)
- Link-time optimizations
-
const
TypeScript enum support - cross-module inlining for bundle-time known objects
-
- Optional concurrency. In the CI-scenario, it needs to work great in parallel and in the edge runtime scenario, it needs to work great potentially running single-threaded.
- Multiple output formats
- IIFE (immediately invoked function expressions)
- CommonJS
- ES Modules
- Continue supporting Hot Module Reloading after these changes
CSS parser:
- CSS Minifier
- CSS Lexer
- CSS Parser/AST
- CSS Auto-prefixer
-
Bun.Transpiler
support for CSS - Support for parsing css inside of JavaScript
-
<style jsx>
support
-
Once complete, the next step is integration with the HTTP server and other Bun APIs
Efficient bundling format
Cache builds into a binary archive format with metadata designed for fast random access, splice()
, and sendfile()
support. Outside of the edge runtime, these will work as a single-file JavaScript executable internally holding many files.
Instances of Bun will need to know what bundle(s) they're serving. From there, instead of going through a filesystem, we can serve static requests directly from the bundle and dynamic requests will bundle on-demand, potentially importing code from statically-bundled code.
-
Bundle
API (not finalized yet)-
Bundle.prototype.resolve(path): string
API -
Bundle.prototype.build(entryPoint, context): Response
API -
Bundle.prototype.generate(entryPoints, options): Promise<Bundle>
API
-
-
JSNode
AST API- Receive context/env data from the HTTP server and/or
Bundle
- Support generated functions
- Support generated classes
- Support generated objects
- Support injecting imports
- Receive context/env data from the HTTP server and/or
Server-side rendering
- Support Next.js (partial support right now)
- Support Remix (partial support right now)
- Support SvelteKit
- Support Nuxt.js
- Support Vite
- Experiment with React-specific optimizations
- Stringify static React elements into raw HTML at bundle-time, handling encoding and escaping correctly
- Support a fast path for generating ETags
- Integrate with
Bundle
,JSNode
, and other Bun APIs
Runtime
- Foreign function interface (FFI) to support loading native code
- Module loader hooks to enable
.vue
,.svelte
,.scss
imports and more.- Implement esbuild's
onLoad
API in bun.js - Implement esbuild's
onResolve
API in bun.js - Support when building for bun.js
- Support when building for web
- A way to configure which hooks to load before bun starts, likely in
bunfig.toml
-
onLoad
plugins from native libraries -
onResolve
plugins from native libraries
- Implement esbuild's
- Fastest SQLite client available in JavaScript
- Fastest PostgreSQL client available in JavaScript
- Explore a socket-based implementation
- Explore a libpq-based implementation
- Fastest MySQL client available in JavaScript
- Explore a socket-based implementation
- Explore a libmysqlclient-based implementation
- TCP sockets API with TLS 1.3, likely based on uSockets
- DNS resolution API, probably using c-ares
- Support
https:
andhttp:
imports. This includes a disk cache possibly integrated into the bundling format. - Support
data:
imports - Support
blob:
imports & URLs (URL.createObjectURL
,URL.revokeObjectURL
) - Reliably unload JavaScript VMs without memory leaks and without restarting bun's process
- Rewrite the JavaScript event loop implementation to be more efficient
Edge Runtime
Slimmer, linux-only build of bun.js:
- Only loads prebundled code
- Design for starting as fast as possible
- No tsconfig.json parsing
- No package.json parsing
- No bunfig.toml parsing
- No node_module resolver
- Use binary bundling format
- Potentially disable NAPI and FFI
- Spawn a new JSGlobalObject per HTTP request and suspend it after response is sent/fully queued
- No
bun install
- No other subcommands
Usability & Developer Experience
- High-quality examples for getting started with bun. Right now, the examples are poor quality.
-
bun
REPL with transpiler-enabled support for async/await, typescript and ES Modules (those are not supported byeval
usually) - Public docs
- Public landing page
- Public github repo
- bun subcommand for running npm packages or URLs that may not already be installed. Like
npx
- GitHub Actions for bun
-
@types/bun
npm package
Ecosystem
- Run Next.js apps in production with bun.js
- Run Remix apps in production with bun.js
- Run SvelteKit apps in production with bun.js
- Use Prisma, Apollo, etc with bun.js
- more frameworks
- Investigate running Vite inside bun.js
- Support running Bun from StackBlitz
Web Compatibility
-
- Import implementation from WebKit/Safari into bun.js
- Support in
fetch
- Support in
Request
- Support in
Response
- Support in
Blob
- Support in
Bun.serve
(HTTP server) - Support in
HTMLRewriter
-
TextEncoderStream
-
TextDecoderStream
-
CompressionStream
- Investigate using libdeflate
-
DecompressionStream
- Investigate using libdeflate
- Fast path for file descriptors
- Fast path for files (from path)
- Fast path for sockets
- Fast path for pipes
- Fast path for bundled assets
-
- Import implementation from WebKit/Safari into bun.js
- Support in
fetch
-
Web Worker
support- Import from WebKit/Safari into bun.js
- Import
postMessage
from WebKit - Import
BroadcastChannel
from WebKit - Import
MessageChannel
from WebKit - Import
structuredClone
from WebKit
-
Import WebCrypto implementation from WebKit/Safari into bun.js
-
Support
OffscreenCanvas
API,ImageBitmap
for 2D graphics. This may use WebKit's implementation or it might use Skia
note: after a little testing, performance of safari's web streams implementation is similar to deno and much faster than node 18. I expect the final result to be faster than deno because bun's TextEncoder/TextDecoder & Blob implementation seems generally faster than safari's
Security
- Verify TLS certificates in
fetch
. Right now, it doesn't. - Investigate supporting Content Security Policy (CSP) in bun.js
- This would mean limiting which domains are accessible to the runtime based on the script execution context and how/where code is loaded into the runtime.
- If we decide to support this, we likely can use WebKit's implementation for most of it.
Windows support
- The HTTP client needs a Windows implementation for the syscalls
- Bun needs test coverage for Windows filepath handling
- All of bun's dependencies need to compile on Windows
- Building JavaScriptCore needs to work on Windows and the JIT tiers need to work. I don't know what the current status of this is. WebKit's bug tracker suggests it may not have JITs enabled which will likely need some patches to fix it.
Node.js Compatibility
- Node-API support
-
child_process
support - non-blocking
"fs"
-
"net"
module -
"crypto"
polyfill should use hardware-accelerated crypto for better performance - Finish
"buffer"
implementation -
require
implementation that natively supports ESM (rather than via transpiler). This would involve subclassingAbstractModuleRecord
in JSC. This would better support lazy-loading CommonJS modules.
Reliability
- Better
fetch
implementation:- HTTP Keep-Alive
- TLS 1.3 0-RTT
- HTTP Pipelining
- Cookie Jar
- HTTP/3 (QUIC)
- Run Web Platform tests
- Run Test262
- Support
ActiveDOMObject
from WebKit so that all native objects can be suspended & terminated
Misc
- Package hoisting for
bun install
- workspace: dependencies
- link: dependencies
- github: dependencies
this seems like a lot of work... wow
Can't wait for full npm-like config support. We are using our own npm registry, and the current build time is 40-60 minutes. If it will be at least 10 minutes this will be a game-changer!
I am waiting for the stable version of the bun. What change bun in the javascript world.
Also waiting for the stable version. So exciting! I bet it's going to take a lot of time though. The scope of this project is much larger than what Node attempts to solve.
can someone confirm that right now I can't use the package mysql2
? It throws me an error because it depends on TLS package and on NET package, and I think they were not implemented yet in Bun, but I am not sure.
still missing websocket server support
Can a tinitiny docker image be placed somewhere in there? 👀
Can't wait for Windows support... I'll be anxiously awaiting it until it's out. 😅
still missing websocket server support
Dito
Are you planning to support http2?
Are you planning to support http2?
HTTP/3 is on #159 so I would say HTTP/2 will likely be added before that
Are you planning to support http2?
HTTP/3 is on #159 so I would say HTTP/2 will likely be added before that
I would say that http3 on roadmap is more about quic protocol and there is no straight inheritance between http3 and http2, so maybe support of http2 needs to be marked explicitly.
Motivated to see a stable version ASAP
Promising !
Any roadmap on a progressive translation ?
When is the support for windows coming? Cant wait for it.
I would say that http3 on roadmap is more about quic protocol and there is no straight inheritance between http3 and http2, so maybe support of http2 needs to be marked explicitly.
Another vote for HTTP/2 as it's a prerequisite to gRPC support.
Any plans to create a desktop app like electron?
When is the support for windows coming? Cant wait for it.
#43 you can use WSL for now
On the topic of CSS parsing, transpilation, minification, etc., what's your stance on dependencies? Do you want to reimplement everything yourself, or would you consider using an embeddable library? If so, I'd love to collaborate with you on embedding Parcel CSS in Bun. It's implemented in Rust, but if we added a C API, I think Bun could call into it pretty easily. It may also work via Bun's napi support, but that would probably be slower. It's about 4x faster than esbuild on benchmarks, minifying over 2 million lines of code per second on a single thread. You can find more info in the announcement blog post from February, though it's gotten even faster since then. Would be cool to work together, and I'm happy to help support how I can.
One thought re: minification, please include a way to exclude class/parameter (on both function and constructor args, and incl. subkeys)/function names from minification as it makes certain dependency injection patterns impossible.
Traditionally, many of the existing DI libraries would use Function.toString() and then use some regex to pull out the fn name & args, but given the reason that is needed and how hacky it is, this may be an opportunity for bun to create a better solution ahead of time, for example by exposing the pre-minified function/class names + argument names programmatically such that they are available at runtime. Note that they much be able to be retrieved before the function is called or class is instantiated.
How about full support for NestJS? Looking forward to it.
[ ] read resolutions
from package.json
Bun should move toward full support for nestjs.
Are there any plans for bun language server? Deno provides one: https://deno.land/manual@v1.29.1/advanced/language_server/overview, so I thought bun might do as well
Bun === GOAT
Setup a donations button!!
As an Electron
or Tauri
alternative.
Maybe should consider to build single-file executable files. .exe
or .msi
for windows and .dmg
and .pkg
for macos.
Would love to eventually see support for Qwik. Down the line would be willing to help with the effort too.
Would love to eventually see support for Qwik. Down the line would be willing to help with the effort too.
Yes!!!!!!!!!!!!!!!!! Qwik + Bun === GOAT
Some cool dependency injection would be nice, such as https://www.npmjs.com/package/node-dependency-injection without decorators and making possible configuring yml files for each enviroment, for example. Keep that absolute good work! Love it <3
Would a linter/formatter be considered in the future? An alternative to eslint that'd use Bun's parser, would be faster and would have a better plugin/config format?
when can have a tool with bundle analyzer?It's like webpack-bundle-analyzer。
https://github.com/webpack-contrib/webpack-bundle-analyzer
of course , Providing 'stats.json' files is also possible
For me the main blockers are:
- Remix with
renderToPipeableStream
- Turborepo
- NestJS
what about native path alias support?
- edit : you can use path alias without any npm module. just add
path
andbaseUrl
in tsconfig.json.
For me the main blockers are:
- Remix with
renderToPipeableStream
React docs statement about renderToPipeableStream
:
This API is specific to Node.js. Environments with Web Streams, like Deno and modern edge runtimes, should use renderToReadableStream instead.
Here is example of remix + bun repo https://github.com/jacob-ebey/bun-remix
For me the main blockers are:
- Remix with
renderToPipeableStream
React docs statement about
renderToPipeableStream
:This API is specific to Node.js. Environments with Web Streams, like Deno and modern edge runtimes, should use renderToReadableStream instead.
Here is example of remix + bun repo https://github.com/jacob-ebey/bun-remix
Yeah I found that. Also I get turborepo to work by simulating yarn usage:
- First setup
workspaces
field inpackage.json
(https://bun.sh/docs/install/workspaces) - Then install dependencies with bun(the
--yarn
flag will generate ayarn.lock
file):
bun install --yarn
- Then setup the
packageManager
field inpackage.json
toyarn
(you should haveyarn
installed in the $PATH):
"packageManager": "yarn@1.22.19"
- Now on every turbo command you should add
--skip-infer
, e.g.:
bun turbo build --skip-infer
Turbo will only use yarn
to generate the package graph, but the packages resolution will be handled by bun. This is a workaround until this issue get fixed vercel/turbo#4762
Please integrate parcel with bun, as some of the problems on the web world are solved very well by them
what about web cache api?
Is there a roadmap of for v1.0 release? Would like to know what's going to be completed for v1.0. Thanks!
amazing!!!
"Supporting both https: and http: imports" - Once this feature is up and running, it has the potential to give Deno a tough run
@Jarred-Sumner, hi, it would be great to update roadmap
When can we get HMR for Frontend dev server?
@Jarred-Sumner Are there any plans for adding custom ts ast transformers?
Hi,
Kindly revise this roadmap to reflect the release of Bun 1.0, or alternatively, create a new roadmap for Bun 2.0.
Hi, is there any development on support for Windows? Been very excited to switch from NodeJs to Bun 👀
Hi, is there any development on support for Windows? Been very excited to switch from NodeJs to Bun 👀
Bun 1.0 did launch with windows support.
@KingCh1ll lots of development - in here:
Any plan to make remote cache available for building with CI in the future?
Amazing work guys, truly beautiful. Tried it out on my existing NextJS app works no issues. Looking forward for better support to make use of all the buntastic benefits
Support running Bun from StackBlitz
And how does it look now?
UDP (including multicast) support should be added as a key requirement for the Edge runtime (for IoT solutions)
Suggestion to add to the Web Bundler
actual Web Worker
support.
Some more interesting discussion here: #2906 (comment)
Note especially the trampoline fallback. I had to build a special webpack plugin to support proper code-splitting.
I'm really wondering if there are any plans for a hosted runtime service, a little bit like deno deploy.
I'm guessing it's not coming too soon otherwise there would have been some talks about it.
(if there ever is, please please please consider enabling log forwarding. Having a solution where you can just access logs real time is just no rational for a production application. you don't need to persist logs, just enable us to forward them somewhere where we can persist them).
@happysalada , Jarred gave some exciting hints here : https://youtu.be/RYla4B3DwxY?feature=shared&t=2413
... what I'm really excited about after 1.0 is hosting and basically we're gonna make it really easy to deploy and really fast and cheap to deploy JavaScript to production. It's gonna be a pretty different architecture than what most existing things that are out there do sort of the same philosophy of we can build a lot of things from scratch on bun we're going to bring that also to hosting and I think we'll have interesting things to talk about there in in six months
i would say css/scss support is a must before calling it ready for battle.
Maybe add a timeline / roadmap for the cluster
feature?
suport for postgres or mongodb
Would be nice to have optimized, Bun-native String and Collections APIs.
a better (maybe native) amqp lib ?
Support Quasar?
looking forward to IIFE in Bun.build
It seems that native support for SQLite, PostgreSQL and MySQL is planned or already implemented.
This is perfect for every developer to choose the right relational database for their project.
But what about fast key-value store for a cache? Something like Redis should be perfect.
It seems that native support for SQLite, PostgreSQL and MySQL is planned or already implemented. This is perfect for every developer to choose the right relational database for their project.
But what about fast key-value store for a cache? Something like Redis should be perfect.
Also Key-Value like Couchbase
a better (maybe native) amqp lib ?
We want to see this too, tried the amqp npm package but it had issues in high throughput that caused the process to hang (last checked about 4 months ago)
Why can't just bun compile the JS or typescript into an executable like Golang / Rust does ?
Without the BUN runtime ofcourse, just become a compiler, This would be insanely beneficial, Shipping a single executable that handles the server and its fast, no runtime, the executable is small. The stuff of dreams
I know that JS is an interpreted language but there's mojo, a compiled language and a superset of python, Java with GraalVM now being compiled, One day or the other JS needs to be compiled
Maybe you should check Hermes Engine.
@norman784 I just looked Static Hermes, I'll give it a try. Still Bun should try do that...
Dear bun core dev team, the current documentation page is quite unattractive, not very user-friendly, and hard to learn from, especially when compared to Deno's official documentation. We would greatly appreciate it if you could improve the UI/UX of the bun homepage
Dear bun core dev team, the current documentation page is quite unattractive, not very user-friendly, and hard to learn from, especially when compared to Deno's official documentation. We would greatly appreciate it if you could improve the UI/UX of the bun homepage
It is likely that it can be improved, but I have to emphasize that the Bun community is very good, any questions you can ask on Discord and they are always willing to help and are very involved. Besides I love that they have put the button "Ask AI" on docs.
will you tend to support Angular Framework like you did with React?
will you tend to support Angular Framework like you did with React?
@moraby256 Angular uses TS, not JSX/TSX like React, and TypeScript is already supported by Bun
SolidJS uses JSX, Bun could support that...
SolidJS uses JSX, Bun could support that...
Is already supported
this has not been updated post Bun 1.0, we will update it soon.
Considering I use this page as a way to keep up with Bun progress, would be nice if this issue got more attention from the main team.
Any plans around http2
server implementation? There are no updates about that in the main thread so I figured I'd check the roadmap but it does not mention anything.
Any plans about official Bun Github Action Verified Creator
?
cluster, http2 🤔
Any plans about official Bun Github Action
Verified Creator
?
Import maps https://github.com/WICG/import-maps
Hi! is there any movement on the css loading front?
I've just tried to run storybook
through bun, but it looks like node:zlib
equivalent isn't available:
$ bunx --bun storybook dev
error: zlib.createBrotliDecompress is not implemented
at node:zlib:2269:65
at node_modules/@storybook/core-server/dist/presets/common-preset.js:12:32306
at node:http:887:29
Will this be part of this roadmap at some point?
When can we have CSS/SCSS parser feature?
When can we have CSS/SCSS parser feature?
Looking forward to the CSS parser too
I would say that http3 on roadmap is more about quic protocol and there is no straight inheritance between http3 and http2, so maybe support of http2 needs to be marked explicitly.
Another vote for HTTP/2 as it's a prerequisite to gRPC support.
Bump... really need this, game changer
based on @Jarred-Sumner's answer here, where does Telemetry fit into the current roadmap?
Please Fix this Bug ASAP #5856
Jarred has already said the bug will be fixed a little bit after v1.1 is finished. The development team is currently working on the Windows release.
Would love to help support work on #2704 as part of the Developer Experience roadmap
Thanks, #Bun for being a fast and easy-to-use JavaScript runtime! I appreciate your speed and compatibility with existing Node.js projects.
+1 for TextDecoderStream
AuthJS relies on this and will be out soon (successor to NextAuth)
⨯ error: Attempt to export a nullable value for "TextDecoderStream"
at defineProperties (file:///workspaces/dev-1/dashboard/node_modules/next/dist/compiled/edge-runtime/index.js:1:1)
at addPrimitives (file:///workspaces/dev-1/dashboard/node_modules/next/dist/compiled/edge-runtime/index.js:13902:25)
at extend (file:///workspaces/dev-1/dashboard/node_modules/next/dist/compiled/edge-runtime/index.js:13854:113)
at new VM (file:///workspaces/dev-1/dashboard/node_modules/next/dist/compiled/edge-runtime/index.js:13946:88)
at new EdgeVM (file:///workspaces/dev-1/dashboard/node_modules/next/dist/compiled/edge-runtime/index.js:13854:16)
at file:///workspaces/dev-1/dashboard/node_modules/next/dist/server/web/sandbox/context.js:102:163
Is NextJS fully supported?
I test on my project it work well
@001123 Do you use "Pages Router" or "App Router" ?
I'm just test on "Pages router"
Any plans to support WebRTC data channels in the API? Very happy with the performance of the WebSockets API and would love to see more of these modern protocols (+1 for HTTP/3) getting some attention. Currently, there are Node.js bindings for libdatachannel but at the time of writing, no runtime has implemented data channels natively.
When can we get CommonJS output format support for the build?
https://bun.sh/docs/bundler#format cjs