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

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.

bun

More Information

Bun Website

Bun On GitHub

Zig Website

Related Articles

Bun 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.

Banner


Remembering Grace Hopper On Her 114th Anniversary
09/12/2024

Today sees the start of Computer Science Education Week and  the 2024 Hour of Code. These educational event are timed to coincide with Grace Hopper's birthday on January 9th, 1906 due to her conc [ ... ]



OpenSilver Adds XAML Designer For Visual Studio Code
12/12/2024

OpenSilver 3.1 has been released. This version adds a drag-and-drop XAML designer for Visual Studio Code (VS Code), a new modern UI theme, and expanded support for WPF features. The open-source altern [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 20 October 2022 )