Bun Adds Hot Reloading |
Written by Kay Ewbank |
Thursday, 20 October 2022 |
Bun, the new JavaScript runtime, has been updated to add hot reloading and zero-downtime restarts. Unusually for open source software it also seems to have cooked up a storm over its choice of benchmarks. Bun is a modern JavaScript runtime aiming at similar uses to Node or Deno. It was built from scratch to focus being fast on startup and on providing a complete tool including bundler, transpiler and package manager. Bun was designed to be a drop-in replacement for your current JavaScript and TypeScript apps or scripts, running either on your local computer, server or on the edge. Written in Zig, Bun is a wrapper around JavaScriptCore, WebKit's JavaScript engine, and natively implements around 90 percent of Node-API functions. The first improvement to the new version is hot reloads on the server, which lets you see code changes immediately, without restarting your server. The developers say that unlike popular file watchers like nodemon, bun --hot preserves some of the state of your app, meaning in-flight HTTP requests don't get interrupted. The next change of note is the ability to spawn processes in Bun. Bun.spawn is flexible. stdin can be a Response, Blob, Request, ArrayBuffer, ArrayBufferView, Bun.file, "pipe" or number. Other improvements include the ability to read Request & Response objects bodies as a ReadableStream, and support for async iterators in ReadableStream. The improvements to Bun so soon after the initial release are interesting, but an equally interesting indication of how seriously it may be being taken by supporters of 'rival' products such as Deno came with a post on Hacker News. The post suggested that the Deno benchmarks created by Bun.js developers comparing runtimes between the two products were chosen to misrepresent how well Deno actually runs. The suggestion was made that this was malicious rather than accidental. However, some commenters pointed out that the post was written by a Deno employee, and the post was later removed. Bun 0.2.0 is available now. More InformationRelated ArticlesBun JavaScript Runtime Adds Runtime Plugin API Deno Adds API Support For Node.js Compatibility Node.js 18 Adds Core Test Runner
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
Last Updated ( Thursday, 20 October 2022 ) |