Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.
中文简介正在准备中。当前显示原文说明。
Bun runtime guidance — fast installs, built-in bundler and test runner, Bun.serve APIs, and migration from Node.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Bun is an all-in-one JavaScript and TypeScript runtime built on JavaScriptCore that replaces Node plus npm plus your bundler plus your test runner with a single fast binary. Its headline features are near-instant installs, a native bundler, a Jest-compatible test runner, and a high-performance HTTP server API (Bun.serve). Bun also aims for broad Node.js compatibility, so most existing projects run with little or no change. This skill covers using Bun effectively, migrating from Node, and knowing where the edges still are.
Bun.serve.bun run (runtime), bun install (package manager), bun build (bundler), bun test (test runner). Learn all four before reaching for webpack/vite/jest equivalents — you often do not need them.node: builtins and npm package semantics. Most pure-JS packages work; native addons and exotic node_modules layouts are where breaks happen — test before switching production.Bun.serve({
port: 3000,
fetch(req) { return new Response("hi"); },
websocket: { message(ws, msg) { ws.send("echo: " + msg); } },
});
bun:sqlite gives a zero-dependency embedded database; bun:ffi calls native libraries directly. Both remove whole dependency classes for small services.tsc or an editor for type errors).bun.lockb, binary by default — text lockfile mode gives readable diffs). Commit it for reproducible installs.bun install reads the npm registry and respects package.json semantics, so migration is usually bun install plus bun run away.--hot watches and reloads on file changes — fast iteration in dev, never in production.macro()) for codegen-like patterns without a build plugin — powerful, but keep macros simple and deterministic..env files automatically — convenient, but ensure secrets still come from the environment in production, not committed files.bun --version.
bun install (npm scripts keep working) or start fresh with bun init. Prefer the text lockfile for clean git diffs.bun run, tests to bun test (Jest-style describe/it/expect mostly works), and builds to bun build ./src/index.ts --outdir=dist --target=bun.
Bun.serve for hot paths; keep framework code (Elysia, Hono) for routing structure. Put SQLite behind bun:sqlite for local-first persistence.open/message/close handlers, track connections in a Set with metadata, and implement application-level heartbeats — the same reliability rules as any socket server.
const clients = new Set<ServerWebSocket<unknown>>();
Bun.serve({
fetch(req, server) {
if (server.upgrade(req)) return;
return new Response("websocket only", { status: 400 });
},
websocket: {
open(ws) { clients.add(ws); },
close(ws) { clients.delete(ws); },
message(ws, msg) { /* handle */ },
},
});
bun build --compile produces a standalone executable — handy for CLIs and single-binary deploys without a runtime install.package.json plus lockfile, run bun install --frozen-lockfile, then copy source — same layer-caching discipline as Node images.child_process behaviors) before cutting over.bun.lockb is unreadable in PRs; use text lockfile mode if reviewability matters to your team.tsc --noEmit in CI or type errors accumulate silently.--hot is for development; production needs a process manager and graceful shutdown.--frozen-lockfile in CI — without it, CI can install different versions than your machine.Bun.serve, bun:sqlite, and bun:ffi do not exist in Node/Deno; isolate them behind adapters if you may switch runtimes.Bun.serve needs explicit signal handling to drain connections on deploy; don't rely on defaults.bun:sqlite is single-writer; high-write workloads need WAL mode or a client-server DB..env discipline — auto-loaded .env files committed with secrets; keep them gitignored and document required vars.bun outdated — dependencies drifting because installs are so fast nobody audits; review updates regularly.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.
中文简介正在准备中。当前显示原文说明。
Create 3D visuals with modeling, texturing, lighting, rendering, and optimization for web and product.
中文简介正在准备中。当前显示原文说明。
Create 3D web experiences: scene setup, models, materials, lighting, animation, scroll-driven scenes, and performance budgets. Use when adding 3D to websites beyond basic demos.
中文简介正在准备中。当前显示原文说明。
Writing abstracts that get papers read — structured content, the 5-sentence core, and journal-specific constraints.
中文简介正在准备中。当前显示原文说明。
Learn effectively from courses and academies: choosing programs, studying actively, and converting courses into skills. Use when investing time/money in structured learning.
中文简介正在准备中。当前显示原文说明。
Audit designs for accessibility with WCAG checklists covering color, type, focus, motion, and content.
中文简介正在准备中。当前显示原文说明。