DEV Community

Ushieru Kokoran
Ushieru Kokoran

Posted on

3 3

Bun - Ya esta aqui.

Bun es el nuevo runtime de JavaScript, escrito en Zig. Bundler nativo, transpilador, task runner y cliente npm. Todo en uno.

Benchmark

Baterías incluidas

  • APIs Web como fetch, WebSocket y ReadableStream.
  • node_modules bun implementa un algoritmo de resolución de módulos de Node.js, por lo que puedes usar paquetes npm en bun.js. ESM y CommonJS son compatibles, pero Bun utiliza internamente ESM.
  • Transpilador de Typescript y JSX.
  • Soporta paths, jsxImportSource y más desde los archivos tsconfig.json.
  • Utiliza las llamadas al sistema más rápidas disponibles con Bun.write para write, copy, pipe, send y clone files.
  • Cargado automatico de .env sin require("dotenv").load()
  • Cliente SQLite3 integrado con bun:sqlite
  • bun:ffi Para codigo iteroperable con JavaScript
  • node:fs node:path Bun soporta de manera nativa la mayoria de modulos del core de Node.js
  • wiptest para test de JavaScript y TypeScript

Que tal si vemos un poco de codigo? 👨‍💻

Levantemos un servidor HTTP sencillito.

// http.js
export default {
  port: 3000,
  fetch(request) {
    return new Response("Welcome to Bun!");
  },
};

Enter fullscreen mode Exit fullscreen mode

Echémoslo a volar con:

bun run http.js
Enter fullscreen mode Exit fullscreen mode

Y ya lo tenemos.

server

Pero que tal si hacemos un app de Next.js?
bun create next ./app

Que tal algo con React?
bun create react ./app

Bun CLI

  • Bun ejecuta package.json scripts hasta x30 más rápido que NPM.
  • Bun instala paquetes NPM hasta x20 más rápido que yarn.

Ve, echale un ojo a su repositorio. Si puedes pruébalo y cuéntame en los comentarios como te fue.

Y Happy Hacking 🎉👨‍💻.

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs