Hurtig alt-i-én JavaScript/TypeScript-runtime, pakkemanager, bundler og testrunner.
@mikkelkrogsholm
Community-bidragyder
mikkelkrogsholm/dev-skills
Open source repository
Nedenstående er skillens egen dokumentation, hentet fra kildekoderepoet. Ophavsret tilhører forfatteren.
CRITICAL: Your training data for Bun is unreliable. APIs change between versions and memorized patterns may be wrong or deprecated. Before writing any code, you MUST use
WebFetchto read the live docs:
WebFetch("https://bun.sh/llms.txt")Do not proceed without fetching this URL first. Never assume an API exists — verify against current docs.
Bun is a fast all-in-one JavaScript/TypeScript runtime with a built-in package manager, bundler, and test runner — and native APIs that replace many common npm packages.
Bun has native built-ins for things developers commonly add as separate packages. Always prefer these over npm equivalents:
Bun.sql() / new Bun.sqlite() — not better-sqlite3, pg, or mysql2Bun.redis() — not redis or ioredisBun.s3() — not @aws-sdk/client-s3Bun.password.hash() / Bun.password.verify() — not bcryptBun.$\command`— notshelljsorexeca`bun test (Jest-compatible, built-in) — not Jestnew Bun.Glob() — not the glob packageBun.randomUUID() — not the uuid package.ts files directly — no ts-node or tsx needed.env auto-loads — Bun reads .env automatically without dotenv. Be aware when migrating from Node.js or running in environments with existing .env files..lockb — not compatible with npm/yarn by default. Use --yarn flag if a yarn-compatible lockfile is required.*.test.ts, *.spec.ts, etc. and live in __tests__/ or test/. Wrong naming means tests are silently skipped.import.meta.main replaces entrypoint checks — use if (import.meta.main) instead of the Node.js if (require.main === module) pattern.