🥟

Bophara

Likarolo tsa ho theha frontend

All-in-one JavaScript runtime. Bundler, tester, le package manager ka sesebelisoa se le seng se potlakileng

Lintlha tsa ho kenya

Ho romelloa ha basebetsi: 2-5 min
sehlopha: Likarolo tsa ho theha frontend
RAM e tlase: 256MB
Tšehetso: Litekete le imeile

Tseba lengolo lena

Tlhaloso

Bun ke runtime ea JavaScript, bundler, test runner le package manager e potlakileng haholo, e entsoeng ho nkela Node.js, webpack, Babel, yarn le tse ling sebaka ka sesebelisoa se le seng se kopaneng. E entsoe ho tloha qalong ka Zig, 'me e sebelisa JavaScriptCore (enjine ea JavaScript ea Safari), Bun e fana ka ts'ebetso e potlakileng ka mekhahla e mengata ho feta lisebelisoa tsa JavaScript tsa setso.

Joalo ka runtime, Bun ke sebaka sa ho nkela Node.js ka potlako, e kenyang APIs tsa Node.js 'me e eketsa ntlafatso e ngata. E qala ka potlako ho feta makhetlo a 4 ho feta Node.js 'me e sebetsa khoutu ea JavaScript/TypeScript ka ts'ebetso e ikhethang. Bun e tšehetsa TypeScript le JSX ka tlhaho ntle le mohato oa transpilation, e felisa tlhoko ea lisebelisoa tse ikhethileng tsa kaho nts'etsopeleng.

Bundler e kentsoeng ea Bun e potlakile haholo ho feta webpack, esbuild kapa Parcel, e kanna ea bundla liprojeke ka milliseconds ho e-na le metsotsoana. E tšehetsa code splitting, tree shaking, minification le likarolo tsohle tsa sejoale-joale tsa bundling ka ho kenngoa ka kotloloho. Hape e kenyelletsa transpiler e kentsoeng e sebetsanang le TypeScript, JSX le syntax ea sejoale-joale ea JavaScript ntle le lisebelisoa tse ling tsa ntle.

Package manager ke e 'ngoe ea likarolo tse ikhethang tsa Bun, e kenya li-package tsa npm ka potlako ho feta npm ka makhetlo a 30 le pnpm ka makhetlo a 20. E kopana le npm registry le sebopeho sa package.json, e etsa hore ho fetohela ho tsoa liprojekeng tsa Node.js tse seng li teng ho be bonolo. Package manager ea Bun hape e kenyelletsa cache ea lefats'e e bolokang sebaka sa disk 'me e potlakisa mekenyo liprojekeng tsohle.

Bun e kenyelletsa test runner e kentsoeng e potlakileng haholo ho feta Jest kapa Vitest, e nang le API e tsebahalang e etsang hore ho fetohela ho be bonolo. Test runner e tšehetsa mocking, snapshots, code coverage le mokhoa oa watch, e fana ka tsohle tse hlokahalang bakeng sa liteko tse felletseng ntle le li-dependencies tse ling.

Ka ts'ehetso e kentsoeng ea Web APIs (fetch, WebSocket, Streams), mefuta ea tikoloho, ho reloada ka potlako le SQLite, Bun e fana ka boiphihlelo bo felletseng bo fokotsang tlhoko ea lipakeji tse ngata tsa boraro. Haeba u haha APIs, lits'ebeliso tse felletseng tsa stack, lisebelisoa tsa CLI kapa microservices, Bun e fana ka boiphihlelo ba nts'etsopele bo sejoale-joale, bo potlakileng le bo monate.

Likarolo tsa bohlokoa

Ts'ebetso e potlakileng haholo

Qalo e potlakile ka makhetlo a 4 ho feta Node.js, 'me ts'ebetso e potlakile haholo ka enjine ea JavaScriptCore

Tšehetso ea TypeScript ka tlhaho

Sebelisa TypeScript le JSX ka kotloloho ntle le mohato oa ho bokella, ho fetolela ka nako ea ho sebetsa

Package manager e potlakileng haholo

Kenya li-package tsa npm ka makhetlo a 30 ho feta npm, ka global cache le ts'ehetso e felletseng

Bundler e kentsoeng

Bundla liprojeke tsa JavaScript/TypeScript ka milliseconds ka code splitting, tree shaking le minification

Test runner e kopaneng

Test runner e potlakileng e tšehetsang API ea Jest, e kenyelletsa mocking, snapshots le coverage

Lisebelisoa tsohle ka sebopeho se le seng

Runtime, bundler, transpiler, package manager le test runner ka binary e le 'ngoe

Mehlala ea ho sebelisa

• Nts'etsopele ea API: Haha REST APIs tse potlakileng haholo le li-server tsa GraphQL ka tšehetso ea pele ea TypeScript
• Lits'ebeliso tse felletseng tsa stack: Ntlafatsa lits'ebeliso tsa webo tsa sejoale-joale ka bundling e potlakileng le ho reloada ka potlako
• Lisebelisoa tsa CLI: Haha lisebelisoa tsa mola-taelo tse qalang ka potlako tse nang le li-dependencies tse fokolang
• Microservices: Romella microservices tse bobebe, tse matla haholo, tse nang le cold starts tse potlakileng
• Lisebelisoa tsa nts'etsopele: Potlakisa mosebetsi oa nts'etsopele ka ho kenya lintho le ho lekola ka potlako
• Edge Computing: Sebelisa JavaScript sebakeng sa edge ka overhead e nyane le ts'ebetso e potlakileng
• Li-script tsa kaho: Nkela lipipeline tse rarahaneng tsa kaho ka li-script tse bonolo, tse potlakileng tsa Bun

Litaelo tsa ho kenya

Ho kenya ho Ubuntu/Linux:
# Install Bun
curl -fsSL https://bun.sh/install | bash

# Verify installation
bun --version

# Update Bun to latest version
bun upgrade
Qalo e potlakileng - Theha projeke e ncha:
# Initialize new project
bun init

# Run TypeScript/JavaScript file
bun run index.ts

# Install dependencies
bun install

# Run with watch mode (hot reload)
bun --watch run index.ts
Sebelisa projeke e teng ea Node.js:
# Install dependencies (much faster than npm)
bun install

# Run with Bun runtime instead of Node
bun run start

# Or use as drop-in Node replacement
bun run dev

Litlhahiso tsa ho kenya

Litlhophiso tse Hlokahalang:

Li-script tsa package.json:
{
  "scripts": {
    "dev": "bun --watch run src/index.ts",
    "build": "bun build src/index.ts --outdir dist",
    "test": "bun test",
    "start": "bun run dist/index.js"
  }
}
Bundling ka Bun:
# Bundle for production
bun build ./src/index.ts --outdir ./dist --target browser

# Bundle with minification
bun build ./src/index.ts --outdir ./dist --minify

# Bundle for Node.js target
bun build ./src/index.ts --outdir ./dist --target node
Liteko:
# Run all tests
bun test

# Run specific test file
bun test auth.test.ts

# Watch mode
bun test --watch

# With coverage
bun test --coverage
Lintho tsa Tikoloho:
- E laisa lifaele tsa .env ka boits'oare
- Fihlella ka process.env kapa Bun.env
- Ha ho hlokehe package ea dotenv

Likeletso tsa ts'ebetso:
- Sebelisa lits'ebetso tsa Bun tsa mehloli (Bun.file, Bun.serve) ho e-na le tse tsoang Node
- Nolofalletsa HTTP/2 ka Bun.serve bakeng sa ts'ebetso e ntle
- Sebelisa bun:sqlite bakeng sa mesebetsi ea database e potlakileng
- Sebelisa fetch e kentsoeng ho e-na le axios

Likopo tsa theknoloji

Litaelo tsa sistimi

  • Khopolo: 256MB RAM

Lekanya Sengoloa sena

★★★★★
-
Ho kenya...

Na o se o loketse ho kenya kopo ya hao? Bophara?

Qala ka metsotsoana ka ts'ebetso ea rona e bonolo ea ho kenya VPS

Ho kenya ka ho ka bang 2 metsotso • Full root ho kena • Thuto ka terene le lengolo tsoibila