A new stable version has been quietly and unnoticed published Good - 1.1.30.
Bun is an ECMAScript/JavaScript runtime environment, similar in many ways to nodejs. Bun is based on JavaScriptCore from Apple, but Bun itself, like many of its modules, is written in the language umpteen. Bun tries to be as compatible as possible with nodejs in terms of command line options, supports ECMAScript (ESM) and CommonJS modules. npm package management and support typescript are built directly into the application as native code, and TypeScript programs can be executed directly by the interpreter without prior configuration.
However, Bun is not just a "copy" of nodejs in its capabilities. In addition to faster operation in a number of scenarios (starting right from the application launch) and almost full support for the API available in nodejs, Bun provides wide capabilities for applications on the server - from working with files to transforming the HTML tree (HTMLRewriter), typescript transpilation module (Bun.Transpiler), built-in work with databases sqlite, modules for interaction with native platform libraries via the C language API – ffibuilt testing toolkit and many other possibilities.
Additionally, in experimental mode, Bun supports integration with C code via transparent invocation cc:
hello.c: int hello() { return 42; } hello.js: import { cc } from "bun:ffi"; import source from "./hello.c" with { type: "file" }; const { symbols: { hello }, } = cc({ source, symbols: { hello: { args: [], returns: "int", }, }, }); console.log("What is the answer to the universe?", hello()); $ bun hello.js What is the answer to the universe? 42
This release, among other things, added a CSS parser based on LightningCSS which was specially rewritten for this purpose from such legacy technologies as inner calm on zig, which allowed transparent integration of css and typescript, and now you can import a css file directly into a typescript module:
index.ts: import "./style.css"; import Component from "./MyComponent.tsx"; // ... rest of your app style.css: /* build result: */ /* style.css */ .hello { background: red; } /* MyComponent.css */ .MyComponent { color: green; }
Bun allows assemble the entire application with all resources into a single executable file.
Source: linux.org.ru
