編集

Bun v1.1.5

2024 年 4 月 26 日に Bun v1.1.5 がリリースされました。

Bun v1.1.5

クロスコンパイルをサポートするようになりました。

bash
# Linux x64
bun build --compile --target=bun-linux-x64 app.ts

# Windows x64
bun build --compile --target=bun-windows-x64 app.ts

# macOS Silicon
bun build --compile --target=bun-darwin-arm64 app.ts

# Linux arm64
bun build --compile --target=bun-linux-arm64 app.ts

package.json の末尾カンマとコメントが許容されるようになりました。

json
{
  "name": "app",
  "dependencies": {
    // We need 0.30.8 because of a bug in 0.30.9
    "drizzle-orm": "0.30.8"
  }
}

Import Attributes を利用して、任意のファイルを特定の形式としてインポートできるようになりました。

jsx

import html from "./index.html" with type { type: "text" };
import json from "./config.foo" with { type: "json" };
import cfg from "./Configfile" with { type: "toml" };

console.log(html); // <!doctype html><html lang="ja"><head>....
console.log(cfg); // { "name": "app" }
console.log(json); // { "name": "app" } (converted to JSON object)
編集