bun-types 1.3.2-canary.20251106T140813 → 1.3.2-canary.20251108T140624

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/bun.d.ts +102 -6
  2. package/docs/bundler/bytecode.mdx +465 -0
  3. package/docs/bundler/css.mdx +1024 -0
  4. package/docs/bundler/esbuild.mdx +253 -0
  5. package/docs/bundler/executables.mdx +535 -0
  6. package/docs/bundler/fullstack.mdx +1064 -0
  7. package/docs/bundler/hot-reloading.mdx +229 -0
  8. package/docs/bundler/html-static.mdx +386 -0
  9. package/docs/bundler/index.mdx +1499 -0
  10. package/docs/bundler/loaders.mdx +356 -0
  11. package/docs/bundler/macros.mdx +328 -0
  12. package/docs/bundler/minifier.mdx +1306 -0
  13. package/docs/bundler/plugins.mdx +411 -0
  14. package/docs/feedback.mdx +85 -0
  15. package/docs/guides/binary/arraybuffer-to-array.mdx +29 -0
  16. package/docs/guides/binary/arraybuffer-to-blob.mdx +26 -0
  17. package/docs/guides/binary/arraybuffer-to-buffer.mdx +27 -0
  18. package/docs/guides/binary/arraybuffer-to-string.mdx +17 -0
  19. package/docs/guides/binary/arraybuffer-to-typedarray.mdx +41 -0
  20. package/docs/guides/binary/blob-to-arraybuffer.mdx +16 -0
  21. package/docs/guides/binary/blob-to-dataview.mdx +16 -0
  22. package/docs/guides/binary/blob-to-stream.mdx +16 -0
  23. package/docs/guides/binary/blob-to-string.mdx +17 -0
  24. package/docs/guides/binary/blob-to-typedarray.mdx +16 -0
  25. package/docs/guides/binary/buffer-to-arraybuffer.mdx +16 -0
  26. package/docs/guides/binary/buffer-to-blob.mdx +16 -0
  27. package/docs/guides/binary/buffer-to-readablestream.mdx +43 -0
  28. package/docs/guides/binary/buffer-to-string.mdx +27 -0
  29. package/docs/guides/binary/buffer-to-typedarray.mdx +16 -0
  30. package/docs/guides/binary/dataview-to-string.mdx +17 -0
  31. package/docs/guides/binary/typedarray-to-arraybuffer.mdx +27 -0
  32. package/docs/guides/binary/typedarray-to-blob.mdx +18 -0
  33. package/docs/guides/binary/typedarray-to-buffer.mdx +16 -0
  34. package/docs/guides/binary/typedarray-to-dataview.mdx +16 -0
  35. package/docs/guides/binary/typedarray-to-readablestream.mdx +43 -0
  36. package/docs/guides/binary/typedarray-to-string.mdx +18 -0
  37. package/docs/guides/deployment/aws-lambda.mdx +204 -0
  38. package/docs/guides/deployment/digital-ocean.mdx +161 -0
  39. package/docs/guides/deployment/google-cloud-run.mdx +197 -0
  40. package/docs/guides/deployment/railway.mdx +145 -0
  41. package/docs/guides/deployment/render.mdx +82 -0
  42. package/docs/guides/deployment/vercel.mdx +99 -0
  43. package/docs/guides/ecosystem/astro.mdx +82 -0
  44. package/docs/guides/ecosystem/discordjs.mdx +80 -0
  45. package/docs/guides/ecosystem/docker.mdx +151 -0
  46. package/docs/guides/ecosystem/drizzle.mdx +195 -0
  47. package/docs/guides/ecosystem/edgedb.mdx +257 -0
  48. package/docs/guides/ecosystem/elysia.mdx +31 -0
  49. package/docs/guides/ecosystem/express.mdx +43 -0
  50. package/docs/guides/ecosystem/hono.mdx +47 -0
  51. package/docs/guides/ecosystem/mongoose.mdx +92 -0
  52. package/docs/guides/ecosystem/neon-drizzle.mdx +234 -0
  53. package/docs/guides/ecosystem/neon-serverless-postgres.mdx +60 -0
  54. package/docs/guides/ecosystem/nextjs.mdx +57 -0
  55. package/docs/guides/ecosystem/nuxt.mdx +90 -0
  56. package/docs/guides/ecosystem/pm2.mdx +55 -0
  57. package/docs/guides/ecosystem/prisma-postgres.mdx +169 -0
  58. package/docs/guides/ecosystem/prisma.mdx +164 -0
  59. package/docs/guides/ecosystem/qwik.mdx +114 -0
  60. package/docs/guides/ecosystem/react.mdx +52 -0
  61. package/docs/guides/ecosystem/remix.mdx +97 -0
  62. package/docs/guides/ecosystem/sentry.mdx +54 -0
  63. package/docs/guides/ecosystem/solidstart.mdx +66 -0
  64. package/docs/guides/ecosystem/ssr-react.mdx +49 -0
  65. package/docs/guides/ecosystem/stric.mdx +54 -0
  66. package/docs/guides/ecosystem/sveltekit.mdx +138 -0
  67. package/docs/guides/ecosystem/systemd.mdx +114 -0
  68. package/docs/guides/ecosystem/upstash.mdx +87 -0
  69. package/docs/guides/ecosystem/vite.mdx +77 -0
  70. package/docs/guides/html-rewriter/extract-links.mdx +72 -0
  71. package/docs/guides/html-rewriter/extract-social-meta.mdx +97 -0
  72. package/docs/guides/http/cluster.mdx +69 -0
  73. package/docs/guides/http/fetch-unix.mdx +35 -0
  74. package/docs/guides/http/fetch.mdx +26 -0
  75. package/docs/guides/http/file-uploads.mdx +97 -0
  76. package/docs/guides/http/hot.mdx +28 -0
  77. package/docs/guides/http/proxy.mdx +26 -0
  78. package/docs/guides/http/server.mdx +48 -0
  79. package/docs/guides/http/simple.mdx +20 -0
  80. package/docs/guides/http/stream-file.mdx +50 -0
  81. package/docs/guides/http/stream-iterator.mdx +49 -0
  82. package/docs/guides/http/stream-node-streams-in-bun.mdx +22 -0
  83. package/docs/guides/http/tls.mdx +32 -0
  84. package/docs/guides/index.mdx +10 -0
  85. package/docs/guides/install/add-dev.mdx +28 -0
  86. package/docs/guides/install/add-git.mdx +38 -0
  87. package/docs/guides/install/add-optional.mdx +27 -0
  88. package/docs/guides/install/add-peer.mdx +45 -0
  89. package/docs/guides/install/add-tarball.mdx +35 -0
  90. package/docs/guides/install/add.mdx +44 -0
  91. package/docs/guides/install/azure-artifacts.mdx +76 -0
  92. package/docs/guides/install/cicd.mdx +43 -0
  93. package/docs/guides/install/custom-registry.mdx +32 -0
  94. package/docs/guides/install/from-npm-install-to-bun-install.mdx +230 -0
  95. package/docs/guides/install/git-diff-bun-lockfile.mdx +47 -0
  96. package/docs/guides/install/jfrog-artifactory.mdx +28 -0
  97. package/docs/guides/install/npm-alias.mdx +25 -0
  98. package/docs/guides/install/registry-scope.mdx +40 -0
  99. package/docs/guides/install/trusted.mdx +50 -0
  100. package/docs/guides/install/workspaces.mdx +70 -0
  101. package/docs/guides/install/yarnlock.mdx +50 -0
  102. package/docs/guides/process/argv.mdx +66 -0
  103. package/docs/guides/process/ctrl-c.mdx +18 -0
  104. package/docs/guides/process/ipc.mdx +69 -0
  105. package/docs/guides/process/nanoseconds.mdx +15 -0
  106. package/docs/guides/process/os-signals.mdx +41 -0
  107. package/docs/guides/process/spawn-stderr.mdx +34 -0
  108. package/docs/guides/process/spawn-stdout.mdx +28 -0
  109. package/docs/guides/process/spawn.mdx +43 -0
  110. package/docs/guides/process/stdin.mdx +62 -0
  111. package/docs/guides/read-file/arraybuffer.mdx +30 -0
  112. package/docs/guides/read-file/buffer.mdx +21 -0
  113. package/docs/guides/read-file/exists.mdx +18 -0
  114. package/docs/guides/read-file/json.mdx +19 -0
  115. package/docs/guides/read-file/mime.mdx +22 -0
  116. package/docs/guides/read-file/stream.mdx +28 -0
  117. package/docs/guides/read-file/string.mdx +24 -0
  118. package/docs/guides/read-file/uint8array.mdx +23 -0
  119. package/docs/guides/read-file/watch.mdx +66 -0
  120. package/docs/guides/runtime/build-time-constants.mdx +295 -0
  121. package/docs/guides/runtime/cicd.mdx +45 -0
  122. package/docs/guides/runtime/codesign-macos-executable.mdx +61 -0
  123. package/docs/guides/runtime/define-constant.mdx +149 -0
  124. package/docs/guides/runtime/delete-directory.mdx +39 -0
  125. package/docs/guides/runtime/delete-file.mdx +21 -0
  126. package/docs/guides/runtime/heap-snapshot.mdx +28 -0
  127. package/docs/guides/runtime/import-html.mdx +17 -0
  128. package/docs/guides/runtime/import-json.mdx +46 -0
  129. package/docs/guides/runtime/import-toml.mdx +32 -0
  130. package/docs/guides/runtime/import-yaml.mdx +104 -0
  131. package/docs/guides/runtime/read-env.mdx +37 -0
  132. package/docs/guides/runtime/set-env.mdx +51 -0
  133. package/docs/guides/runtime/shell.mdx +42 -0
  134. package/docs/guides/runtime/timezone.mdx +38 -0
  135. package/docs/guides/runtime/tsconfig-paths.mdx +31 -0
  136. package/docs/guides/runtime/typescript.mdx +51 -0
  137. package/docs/guides/runtime/vscode-debugger.mdx +48 -0
  138. package/docs/guides/runtime/web-debugger.mdx +103 -0
  139. package/docs/guides/streams/node-readable-to-arraybuffer.mdx +13 -0
  140. package/docs/guides/streams/node-readable-to-blob.mdx +13 -0
  141. package/docs/guides/streams/node-readable-to-json.mdx +14 -0
  142. package/docs/guides/streams/node-readable-to-string.mdx +14 -0
  143. package/docs/guides/streams/node-readable-to-uint8array.mdx +13 -0
  144. package/docs/guides/streams/to-array.mdx +16 -0
  145. package/docs/guides/streams/to-arraybuffer.mdx +16 -0
  146. package/docs/guides/streams/to-blob.mdx +16 -0
  147. package/docs/guides/streams/to-buffer.mdx +17 -0
  148. package/docs/guides/streams/to-json.mdx +16 -0
  149. package/docs/guides/streams/to-string.mdx +16 -0
  150. package/docs/guides/streams/to-typedarray.mdx +24 -0
  151. package/docs/guides/test/bail.mdx +24 -0
  152. package/docs/guides/test/coverage-threshold.mdx +67 -0
  153. package/docs/guides/test/coverage.mdx +49 -0
  154. package/docs/guides/test/happy-dom.mdx +73 -0
  155. package/docs/guides/test/migrate-from-jest.mdx +125 -0
  156. package/docs/guides/test/mock-clock.mdx +50 -0
  157. package/docs/guides/test/mock-functions.mdx +70 -0
  158. package/docs/guides/test/rerun-each.mdx +16 -0
  159. package/docs/guides/test/run-tests.mdx +116 -0
  160. package/docs/guides/test/skip-tests.mdx +43 -0
  161. package/docs/guides/test/snapshot.mdx +102 -0
  162. package/docs/guides/test/spy-on.mdx +49 -0
  163. package/docs/guides/test/svelte-test.mdx +113 -0
  164. package/docs/guides/test/testing-library.mdx +93 -0
  165. package/docs/guides/test/timeout.mdx +17 -0
  166. package/docs/guides/test/todo-tests.mdx +74 -0
  167. package/docs/guides/test/update-snapshots.mdx +49 -0
  168. package/docs/guides/test/watch-mode.mdx +24 -0
  169. package/docs/guides/util/base64.mdx +17 -0
  170. package/docs/guides/util/deep-equals.mdx +41 -0
  171. package/docs/guides/util/deflate.mdx +20 -0
  172. package/docs/guides/util/detect-bun.mdx +25 -0
  173. package/docs/guides/util/entrypoint.mdx +19 -0
  174. package/docs/guides/util/escape-html.mdx +24 -0
  175. package/docs/guides/util/file-url-to-path.mdx +16 -0
  176. package/docs/guides/util/gzip.mdx +20 -0
  177. package/docs/guides/util/hash-a-password.mdx +56 -0
  178. package/docs/guides/util/import-meta-dir.mdx +15 -0
  179. package/docs/guides/util/import-meta-file.mdx +15 -0
  180. package/docs/guides/util/import-meta-path.mdx +15 -0
  181. package/docs/guides/util/javascript-uuid.mdx +25 -0
  182. package/docs/guides/util/main.mdx +43 -0
  183. package/docs/guides/util/path-to-file-url.mdx +16 -0
  184. package/docs/guides/util/sleep.mdx +24 -0
  185. package/docs/guides/util/version.mdx +23 -0
  186. package/docs/guides/util/which-path-to-executable-bin.mdx +17 -0
  187. package/docs/guides/websocket/compression.mdx +33 -0
  188. package/docs/guides/websocket/context.mdx +74 -0
  189. package/docs/guides/websocket/pubsub.mdx +40 -0
  190. package/docs/guides/websocket/simple.mdx +35 -0
  191. package/docs/guides/write-file/append.mdx +54 -0
  192. package/docs/guides/write-file/basic.mdx +46 -0
  193. package/docs/guides/write-file/blob.mdx +30 -0
  194. package/docs/guides/write-file/cat.mdx +19 -0
  195. package/docs/guides/write-file/file-cp.mdx +18 -0
  196. package/docs/guides/write-file/filesink.mdx +54 -0
  197. package/docs/guides/write-file/response.mdx +19 -0
  198. package/docs/guides/write-file/stdout.mdx +23 -0
  199. package/docs/guides/write-file/stream.mdx +19 -0
  200. package/docs/guides/write-file/unlink.mdx +18 -0
  201. package/docs/index.mdx +133 -0
  202. package/docs/installation.mdx +365 -0
  203. package/docs/pm/bunx.mdx +83 -0
  204. package/docs/pm/catalogs.mdx +292 -0
  205. package/docs/pm/cli/add.mdx +179 -0
  206. package/docs/pm/cli/audit.mdx +60 -0
  207. package/docs/pm/cli/install.mdx +471 -0
  208. package/docs/pm/cli/link.mdx +48 -0
  209. package/docs/pm/cli/outdated.mdx +197 -0
  210. package/docs/pm/cli/patch.mdx +69 -0
  211. package/docs/pm/cli/pm.mdx +319 -0
  212. package/docs/pm/cli/publish.mdx +123 -0
  213. package/docs/pm/cli/remove.mdx +16 -0
  214. package/docs/pm/cli/update.mdx +140 -0
  215. package/docs/pm/cli/why.mdx +84 -0
  216. package/docs/pm/filter.mdx +102 -0
  217. package/docs/pm/global-cache.mdx +72 -0
  218. package/docs/pm/isolated-installs.mdx +205 -0
  219. package/docs/pm/lifecycle.mdx +57 -0
  220. package/docs/pm/lockfile.mdx +64 -0
  221. package/docs/pm/npmrc.mdx +111 -0
  222. package/docs/pm/overrides.mdx +83 -0
  223. package/docs/pm/scopes-registries.mdx +35 -0
  224. package/docs/pm/security-scanner-api.mdx +95 -0
  225. package/docs/pm/workspaces.mdx +109 -0
  226. package/docs/project/benchmarking.mdx +218 -0
  227. package/docs/project/bindgen.mdx +223 -0
  228. package/docs/project/building-windows.mdx +133 -0
  229. package/docs/project/contributing.mdx +343 -0
  230. package/docs/project/feedback.mdx +20 -0
  231. package/docs/project/license.mdx +78 -0
  232. package/docs/project/roadmap.mdx +8 -0
  233. package/docs/quickstart.mdx +240 -0
  234. package/docs/runtime/auto-install.mdx +97 -0
  235. package/docs/runtime/binary-data.mdx +846 -0
  236. package/docs/runtime/bun-apis.mdx +59 -0
  237. package/docs/runtime/bunfig.mdx +642 -0
  238. package/docs/runtime/c-compiler.mdx +204 -0
  239. package/docs/runtime/child-process.mdx +532 -0
  240. package/docs/runtime/color.mdx +267 -0
  241. package/docs/runtime/console.mdx +67 -0
  242. package/docs/runtime/cookies.mdx +454 -0
  243. package/docs/runtime/debugger.mdx +335 -0
  244. package/docs/runtime/environment-variables.mdx +214 -0
  245. package/docs/runtime/ffi.mdx +565 -0
  246. package/docs/runtime/file-io.mdx +306 -0
  247. package/docs/runtime/file-system-router.mdx +118 -0
  248. package/docs/runtime/file-types.mdx +354 -0
  249. package/docs/runtime/glob.mdx +181 -0
  250. package/docs/runtime/globals.mdx +72 -0
  251. package/docs/runtime/hashing.mdx +315 -0
  252. package/docs/runtime/html-rewriter.mdx +340 -0
  253. package/docs/runtime/http/cookies.mdx +79 -0
  254. package/docs/runtime/http/error-handling.mdx +40 -0
  255. package/docs/runtime/http/metrics.mdx +36 -0
  256. package/docs/runtime/http/routing.mdx +289 -0
  257. package/docs/runtime/http/server.mdx +647 -0
  258. package/docs/runtime/http/tls.mdx +101 -0
  259. package/docs/runtime/http/websockets.mdx +404 -0
  260. package/docs/runtime/index.mdx +223 -0
  261. package/docs/runtime/jsx.mdx +115 -0
  262. package/docs/runtime/module-resolution.mdx +342 -0
  263. package/docs/runtime/networking/dns.mdx +111 -0
  264. package/docs/runtime/networking/fetch.mdx +468 -0
  265. package/docs/runtime/networking/tcp.mdx +239 -0
  266. package/docs/runtime/networking/udp.mdx +129 -0
  267. package/docs/runtime/node-api.mdx +19 -0
  268. package/docs/runtime/nodejs-compat.mdx +468 -0
  269. package/docs/runtime/plugins.mdx +405 -0
  270. package/docs/runtime/redis.mdx +582 -0
  271. package/docs/runtime/s3.mdx +863 -0
  272. package/docs/runtime/secrets.mdx +336 -0
  273. package/docs/runtime/semver.mdx +57 -0
  274. package/docs/runtime/shell.mdx +637 -0
  275. package/docs/runtime/sql.mdx +1404 -0
  276. package/docs/runtime/sqlite.mdx +699 -0
  277. package/docs/runtime/streams.mdx +232 -0
  278. package/docs/runtime/templating/create.mdx +269 -0
  279. package/docs/runtime/templating/init.mdx +58 -0
  280. package/docs/runtime/transpiler.mdx +288 -0
  281. package/docs/runtime/typescript.mdx +58 -0
  282. package/docs/runtime/utils.mdx +922 -0
  283. package/docs/runtime/watch-mode.mdx +161 -0
  284. package/docs/runtime/web-apis.mdx +29 -0
  285. package/docs/runtime/workers.mdx +328 -0
  286. package/docs/runtime/yaml.mdx +469 -0
  287. package/docs/snippets/cli/add.mdx +166 -0
  288. package/docs/snippets/cli/build.mdx +196 -0
  289. package/docs/snippets/cli/feedback.mdx +17 -0
  290. package/docs/snippets/cli/init.mdx +84 -0
  291. package/docs/snippets/cli/install.mdx +173 -0
  292. package/docs/snippets/cli/link.mdx +163 -0
  293. package/docs/snippets/cli/outdated.mdx +140 -0
  294. package/docs/snippets/cli/patch.mdx +171 -0
  295. package/docs/snippets/cli/publish.mdx +198 -0
  296. package/docs/snippets/cli/remove.mdx +146 -0
  297. package/docs/snippets/cli/run.mdx +293 -0
  298. package/docs/snippets/cli/test.mdx +100 -0
  299. package/docs/snippets/cli/update.mdx +144 -0
  300. package/docs/snippets/product-card.mdx +32 -0
  301. package/docs/snippets/product-tiles.mdx +94 -0
  302. package/docs/test/code-coverage.mdx +409 -0
  303. package/docs/test/configuration.mdx +467 -0
  304. package/docs/test/dates-times.mdx +129 -0
  305. package/docs/test/discovery.mdx +90 -0
  306. package/docs/test/dom.mdx +226 -0
  307. package/docs/test/index.mdx +380 -0
  308. package/docs/test/lifecycle.mdx +348 -0
  309. package/docs/test/mocks.mdx +637 -0
  310. package/docs/test/reporters.mdx +117 -0
  311. package/docs/test/runtime-behavior.mdx +342 -0
  312. package/docs/test/snapshots.mdx +434 -0
  313. package/docs/test/writing-tests.mdx +635 -0
  314. package/docs/typescript.mdx +54 -0
  315. package/package.json +8 -6
  316. package/test.d.ts +2 -2
@@ -0,0 +1,343 @@
1
+ ---
2
+ title: Contributing
3
+ description: Contributing to Bun
4
+ ---
5
+
6
+ Configuring a development environment for Bun can take 10-30 minutes depending on your internet connection and computer speed. You will need ~10GB of free disk space for the repository and build artifacts.
7
+
8
+ If you are using Windows, please refer to [this guide](/project/building-windows)
9
+
10
+ ## Install Dependencies
11
+
12
+ Using your system's package manager, install Bun's dependencies:
13
+
14
+ <CodeGroup>
15
+
16
+ ```bash macOS (Homebrew)
17
+ $ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
18
+ ```
19
+
20
+ ```bash Ubuntu/Debian
21
+ $ sudo apt install curl wget lsb-release software-properties-common cargo ccache cmake git golang libtool ninja-build pkg-config rustc ruby-full xz-utils
22
+ ```
23
+
24
+ ```bash Arch
25
+ $ sudo pacman -S base-devel ccache cmake git go libiconv libtool make ninja pkg-config python rust sed unzip ruby
26
+ ```
27
+
28
+ ```bash Fedora
29
+ $ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
30
+ ```
31
+
32
+ ```bash openSUSE Tumbleweed
33
+ $ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable
34
+ ```
35
+
36
+ </CodeGroup>
37
+
38
+ > **Note**: The Zig compiler is automatically installed and updated by the build scripts. Manual installation is not required.
39
+
40
+ Before starting, you will need to already have a release build of Bun installed, as we use our bundler to transpile and minify our code, as well as for code generation scripts.
41
+
42
+ <CodeGroup>
43
+
44
+ ```bash Native
45
+ $ curl -fsSL https://bun.com/install | bash
46
+ ```
47
+
48
+ ```bash npm
49
+ $ npm install -g bun
50
+ ```
51
+
52
+ ```bash Homebrew
53
+ $ brew tap oven-sh/bun
54
+ $ brew install bun
55
+ ```
56
+
57
+ </CodeGroup>
58
+
59
+ ## Install LLVM
60
+
61
+ Bun requires LLVM 19 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
62
+
63
+ <CodeGroup>
64
+
65
+ ```bash macOS (Homebrew)
66
+ $ brew install llvm@19
67
+ ```
68
+
69
+ ```bash Ubuntu/Debian
70
+ $ # LLVM has an automatic installation script that is compatible with all versions of Ubuntu
71
+ $ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 19 all
72
+ ```
73
+
74
+ ```bash Arch
75
+ $ sudo pacman -S llvm clang lld
76
+ ```
77
+
78
+ ```bash Fedora
79
+ $ sudo dnf install llvm clang lld-devel
80
+ ```
81
+
82
+ ```bash openSUSE Tumbleweed
83
+ $ sudo zypper install clang19 lld19 llvm19
84
+ ```
85
+
86
+ </CodeGroup>
87
+
88
+ If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.7).
89
+
90
+ Make sure Clang/LLVM 19 is in your path:
91
+
92
+ ```bash
93
+ $ which clang-19
94
+ ```
95
+
96
+ If not, run this to manually add it:
97
+
98
+ <CodeGroup>
99
+
100
+ ```bash macOS (Homebrew)
101
+ # use fish_add_path if you're using fish
102
+ # use path+="$(brew --prefix llvm@19)/bin" if you are using zsh
103
+ $ export PATH="$(brew --prefix llvm@19)/bin:$PATH"
104
+ ```
105
+
106
+ ```bash Arch
107
+ # use fish_add_path if you're using fish
108
+ $ export PATH="$PATH:/usr/lib/llvm19/bin"
109
+ ```
110
+
111
+ </CodeGroup>
112
+
113
+ <Warning>
114
+ ⚠️ Ubuntu distributions (\<= 20.04) may require installation of the C++ standard library independently. See the [troubleshooting section](#span-file-not-found-on-ubuntu) for more information.
115
+ </Warning>
116
+
117
+ ## Building Bun
118
+
119
+ After cloning the repository, run the following command to build. This may take a while as it will clone submodules and build dependencies.
120
+
121
+ ```bash
122
+ bun run build
123
+ ```
124
+
125
+ The binary will be located at `./build/debug/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun.
126
+
127
+ ```bash
128
+ $ build/debug/bun-debug --version
129
+ x.y.z_debug
130
+ ```
131
+
132
+ ## VSCode
133
+
134
+ VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Zig and C++. ZLS is automatically configured.
135
+
136
+ If you use a different editor, make sure that you tell ZLS to use the automatically installed Zig compiler, which is located at `./vendor/zig/zig.exe`. The filename is `zig.exe` so that it works as expected on Windows, but it still works on macOS/Linux (it just has a surprising file extension).
137
+
138
+ We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-debug` in your terminal:
139
+
140
+ ```sh
141
+ bun-debug
142
+ ```
143
+
144
+ ## Running debug builds
145
+
146
+ The `bd` package.json script compiles and runs a debug build of Bun, only printing the output of the build process if it fails.
147
+
148
+ ```sh
149
+ bun bd <args>
150
+ bun bd test foo.test.ts
151
+ bun bd ./foo.ts
152
+ ```
153
+
154
+ Bun generally takes about 2.5 minutes to compile a debug build when there are Zig changes. If your development workflow is "change one line, save, rebuild", you will spend too much time waiting for the build to finish. Instead:
155
+
156
+ - Batch up your changes
157
+ - Ensure zls is running with incremental watching for LSP errors (if you use VSCode and install Zig and run `bun run build` once to download Zig, this should just work)
158
+ - Prefer using the debugger ("CodeLLDB" in VSCode) to step through the code.
159
+ - Use debug logs. `BUN_DEBUG_<scope>=1` will enable debug logging for the corresponding `Output.scoped(.<scope>, false)` logs. You can also set `BUN_DEBUG_QUIET_LOGS=1` to disable all debug logging that isn't explicitly enabled. To dump debug lgos into a file, `BUN_DEBUG=<path-to-file>.log`. Debug logs are aggressively removed in release builds.
160
+ - src/js/\*\*.ts changes are pretty much instant to rebuild. C++ changes are a bit slower, but still much faster than the Zig code (Zig is one compilation unit, C++ is many).
161
+
162
+ ## Code generation scripts
163
+
164
+ Several code generation scripts are used during Bun's build process. These are run automatically when changes are made to certain files.
165
+
166
+ In particular, these are:
167
+
168
+ - `./src/codegen/generate-jssink.ts` -- Generates `build/debug/codegen/JSSink.cpp`, `build/debug/codegen/JSSink.h` which implement various classes for interfacing with `ReadableStream`. This is internally how `FileSink`, `ArrayBufferSink`, `"type": "direct"` streams and other code related to streams works.
169
+ - `./src/codegen/generate-classes.ts` -- Generates `build/debug/codegen/ZigGeneratedClasses*`, which generates Zig & C++ bindings for JavaScriptCore classes implemented in Zig. In `**/*.classes.ts` files, we define the interfaces for various classes, methods, prototypes, getters/setters etc which the code generator reads to generate boilerplate code implementing the JavaScript objects in C++ and wiring them up to Zig
170
+ - `./src/codegen/cppbind.ts` -- Generates automatic Zig bindings for C++ functions marked with `[[ZIG_EXPORT]]` attributes.
171
+ - `./src/codegen/bundle-modules.ts` -- Bundles built-in modules like `node:fs`, `bun:ffi` into files we can include in the final binary. In development, these can be reloaded without rebuilding Zig (you still need to run `bun run build`, but it re-reads the transpiled files from disk afterwards). In release builds, these are embedded into the binary.
172
+ - `./src/codegen/bundle-functions.ts` -- Bundles globally-accessible functions implemented in JavaScript/TypeScript like `ReadableStream`, `WritableStream`, and a handful more. These are used similarly to the builtin modules, but the output more closely aligns with what WebKit/Safari does for Safari's built-in functions so that we can copy-paste the implementations from WebKit as a starting point.
173
+
174
+ ## Modifying ESM modules
175
+
176
+ Certain modules like `node:fs`, `node:stream`, `bun:sqlite`, and `ws` are implemented in JavaScript. These live in `src/js/{node,bun,thirdparty}` files and are pre-bundled using Bun.
177
+
178
+ ## Release build
179
+
180
+ To compile a release build of Bun, run:
181
+
182
+ ```bash
183
+ bun run build:release
184
+ ```
185
+
186
+ The binary will be located at `./build/release/bun` and `./build/release/bun-profile`.
187
+
188
+ ### Download release build from pull requests
189
+
190
+ To save you time spent building a release build locally, we provide a way to run release builds from pull requests. This is useful for manually testing changes in a release build before they are merged.
191
+
192
+ To run a release build from a pull request, you can use the `bun-pr` npm package:
193
+
194
+ ```sh
195
+ bunx bun-pr <pr-number>
196
+ bunx bun-pr <branch-name>
197
+ bunx bun-pr "https://github.com/oven-sh/bun/pull/1234566"
198
+ bunx bun-pr --asan <pr-number> # Linux x64 only
199
+ ```
200
+
201
+ This will download the release build from the pull request and add it to `$PATH` as `bun-${pr-number}`. You can then run the build with `bun-${pr-number}`.
202
+
203
+ ```sh
204
+ bun-1234566 --version
205
+ ```
206
+
207
+ This works by downloading the release build from the GitHub Actions artifacts on the linked pull request. You may need the `gh` CLI installed to authenticate with GitHub.
208
+
209
+ ## AddressSanitizer
210
+
211
+ [AddressSanitizer](https://en.wikipedia.org/wiki/AddressSanitizer) helps find memory issues, and is enabled by default in debug builds of Bun on Linux and macOS. This includes the Zig code and all dependencies. It makes the Zig code take about 2x longer to build, if that's stopping you from being productive you can disable it by setting `-Denable_asan=$<IF:$<BOOL:${ENABLE_ASAN}>,true,false>` to `-Denable_asan=false` in the `cmake/targets/BuildBun.cmake` file, but generally we recommend batching your changes up between builds.
212
+
213
+ To build a release build with Address Sanitizer, run:
214
+
215
+ ```bash
216
+ bun run build:release:asan
217
+ ```
218
+
219
+ In CI, we run our test suite with at least one target that is built with Address Sanitizer.
220
+
221
+ ## Building WebKit locally + Debug mode of JSC
222
+
223
+ WebKit is not cloned by default (to save time and disk space). To clone and build WebKit locally, run:
224
+
225
+ ```bash
226
+ # Clone WebKit into ./vendor/WebKit
227
+ $ git clone https://github.com/oven-sh/WebKit vendor/WebKit
228
+
229
+ # Check out the commit hash specified in `set(WEBKIT_VERSION <commit_hash>)` in cmake/tools/SetupWebKit.cmake
230
+ $ git -C vendor/WebKit checkout <commit_hash>
231
+
232
+ # Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug
233
+ # Optionally, you can use `bun run jsc:build` for a release build
234
+ bun run jsc:build:debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
235
+
236
+ # After an initial run of `make jsc-debug`, you can rebuild JSC with:
237
+ $ cmake --build vendor/WebKit/WebKitBuild/Debug --target jsc && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
238
+
239
+ # Build bun with the local JSC build
240
+ bun run build:local
241
+ ```
242
+
243
+ Using `bun run build:local` will build Bun in the `./build/debug-local` directory (instead of `./build/debug`), you'll have to change a couple of places to use this new directory:
244
+
245
+ - The first line in `src/js/builtins.d.ts`
246
+ - The `CompilationDatabase` line in `.clangd` config should be `CompilationDatabase: build/debug-local`
247
+ - In `build.zig`, the `codegen_path` option should be `build/debug-local/codegen` (instead of `build/debug/codegen`)
248
+ - In `.vscode/launch.json`, many configurations use `./build/debug/`, change them as you see fit
249
+
250
+ Note that the WebKit folder, including build artifacts, is 8GB+ in size.
251
+
252
+ If you are using a JSC debug build and using VScode, make sure to run the `C/C++: Select a Configuration` command to configure intellisense to find the debug headers.
253
+
254
+ Note that if you change make changes to our [WebKit fork](https://github.com/oven-sh/WebKit), you will also have to change `SetupWebKit.cmake` to point to the commit hash.
255
+
256
+ ## Troubleshooting
257
+
258
+ ### 'span' file not found on Ubuntu
259
+
260
+ <Warning>
261
+ ⚠️ Please note that the instructions below are specific to issues occurring on Ubuntu. It is unlikely that the same
262
+ issues will occur on other Linux distributions.
263
+ </Warning>
264
+
265
+ The Clang compiler typically uses the `libstdc++` C++ standard library by default. `libstdc++` is the default C++ Standard Library implementation provided by the GNU Compiler Collection (GCC). While Clang may link against the `libc++` library, this requires explicitly providing the `-stdlib` flag when running Clang.
266
+
267
+ Bun relies on C++20 features like `std::span`, which are not available in GCC versions lower than 11. GCC 10 doesn't have all of the C++20 features implemented. As a result, running `make setup` may fail with the following error:
268
+
269
+ ```txt
270
+ fatal error: 'span' file not found
271
+ #include <span>
272
+ ^~~~~~
273
+ ```
274
+
275
+ The issue may manifest when initially running `bun setup` as Clang being unable to compile a simple program:
276
+
277
+ ```txt
278
+ The C++ compiler
279
+
280
+ "/usr/bin/clang++-19"
281
+
282
+ is not able to compile a simple test program.
283
+ ```
284
+
285
+ To fix the error, we need to update the GCC version to 11. To do this, we'll need to check if the latest version is available in the distribution's official repositories or use a third-party repository that provides GCC 11 packages. Here are general steps:
286
+
287
+ ```bash
288
+ $ sudo apt update
289
+ $ sudo apt install gcc-11 g++-11
290
+ # If the above command fails with `Unable to locate package gcc-11` we need
291
+ # to add the APT repository
292
+ $ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
293
+ # Now run `apt install` again
294
+ $ sudo apt install gcc-11 g++-11
295
+ ```
296
+
297
+ Now, we need to set GCC 11 as the default compiler:
298
+
299
+ ```bash
300
+ $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
301
+ $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100
302
+ ```
303
+
304
+ ### libarchive
305
+
306
+ If you see an error on macOS when compiling `libarchive`, run:
307
+
308
+ ```bash
309
+ $ brew install pkg-config
310
+ ```
311
+
312
+ ### macOS `library not found for -lSystem`
313
+
314
+ If you see this error when compiling, run:
315
+
316
+ ```bash
317
+ $ xcode-select --install
318
+ ```
319
+
320
+ ### Cannot find `libatomic.a`
321
+
322
+ Bun defaults to linking `libatomic` statically, as not all systems have it. If you are building on a distro that does not have a static libatomic available, you can run the following command to enable dynamic linking:
323
+
324
+ ```bash
325
+ bun run build -DUSE_STATIC_LIBATOMIC=OFF
326
+ ```
327
+
328
+ The built version of Bun may not work on other systems if compiled this way.
329
+
330
+ ### ccache conflicts with building TinyCC on macOS
331
+
332
+ If you run into issues with `ccache` when building TinyCC, try reinstalling ccache
333
+
334
+ ```bash
335
+ brew uninstall ccache
336
+ brew install ccache
337
+ ```
338
+
339
+ ## Using bun-debug
340
+
341
+ - Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging)
342
+ - Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`)
343
+ - Bun transpiles every file it runs, to see the actual executed source in a debug build find it in `/tmp/bun-debug-src/...path/to/file`, for example the transpiled version of `/home/bun/index.ts` would be in `/tmp/bun-debug-src/home/bun/index.ts`
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: bun feedback
3
+ description: Share feedback, bug reports, and feature requests
4
+ ---
5
+
6
+ import Feedback from "/snippets/cli/feedback.mdx";
7
+
8
+ Use `bun feedback` to share feedback, bug reports, and feature requests directly with the Bun team.
9
+
10
+ ```bash terminal icon="terminal"
11
+ bun feedback "Love the new release!"
12
+ bun feedback report.txt details.log
13
+ echo "please document X" | bun feedback --email you@example.com
14
+ ```
15
+
16
+ You can provide feedback as text arguments, file paths, or piped input.
17
+
18
+ ---
19
+
20
+ <Feedback />
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: License
3
+ description: License for Bun
4
+ ---
5
+
6
+ Bun itself is MIT-licensed.
7
+
8
+ ## JavaScriptCore
9
+
10
+ Bun statically links JavaScriptCore (and WebKit) which is LGPL-2 licensed. WebCore files from WebKit are also licensed under LGPL2. Per LGPL2:
11
+
12
+ > (1) If you statically link against an LGPL'd library, you must also provide your application in an object (not necessarily source) format, so that a user has the opportunity to modify the library and relink the application.
13
+
14
+ You can find the patched version of WebKit used by Bun here: [https://github.com/oven-sh/webkit](https://github.com/oven-sh/webkit). If you would like to relink Bun with changes:
15
+
16
+ - `git submodule update --init --recursive`
17
+ - `make jsc`
18
+ - `zig build`
19
+
20
+ This compiles JavaScriptCore, compiles Bun's `.cpp` bindings for JavaScriptCore (which are the object files using JavaScriptCore) and outputs a new `bun` binary with your changes.
21
+
22
+ ## Linked libraries
23
+
24
+ Bun statically links these libraries:
25
+
26
+ | Library | License |
27
+ | ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
28
+ | [`boringssl`](https://boringssl.googlesource.com/boringssl/) | [several licenses](https://boringssl.googlesource.com/boringssl/+/refs/heads/master/LICENSE) |
29
+ | [`brotli`](https://github.com/google/brotli) | MIT |
30
+ | [`libarchive`](https://github.com/libarchive/libarchive) | [several licenses](https://github.com/libarchive/libarchive/blob/master/COPYING) |
31
+ | [`lol-html`](https://github.com/cloudflare/lol-html/tree/master/c-api) | BSD 3-Clause |
32
+ | [`mimalloc`](https://github.com/microsoft/mimalloc) | MIT |
33
+ | [`picohttp`](https://github.com/h2o/picohttpparser) | dual-licensed under the Perl License or the MIT License |
34
+ | [`zstd`](https://github.com/facebook/zstd) | dual-licensed under the BSD License or GPLv2 license |
35
+ | [`simdutf`](https://github.com/simdutf/simdutf) | Apache 2.0 |
36
+ | [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
37
+ | [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
38
+ | [`zlib-cloudflare`](https://github.com/cloudflare/zlib) | zlib |
39
+ | [`c-ares`](https://github.com/c-ares/c-ares) | MIT licensed |
40
+ | [`libicu`](https://github.com/unicode-org/icu) 72 | [license here](https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE) |
41
+ | [`libbase64`](https://github.com/aklomp/base64/blob/master/LICENSE) | BSD 2-Clause |
42
+ | [`libuv`](https://github.com/libuv/libuv) (on Windows) | MIT |
43
+ | [`libdeflate`](https://github.com/ebiggers/libdeflate) | MIT |
44
+ | A fork of [`uWebsockets`](https://github.com/jarred-sumner/uwebsockets) | Apache 2.0 licensed |
45
+ | Parts of [Tigerbeetle's IO code](https://github.com/tigerbeetle/tigerbeetle/blob/532c8b70b9142c17e07737ab6d3da68d7500cbca/src/io/windows.zig#L1) | Apache 2.0 licensed |
46
+
47
+ ## Polyfills
48
+
49
+ For compatibility reasons, the following packages are embedded into Bun's binary and injected if imported.
50
+
51
+ | Package | License |
52
+ | ------------------------------------------------------------------------ | ------- |
53
+ | [`assert`](https://npmjs.com/package/assert) | MIT |
54
+ | [`browserify-zlib`](https://npmjs.com/package/browserify-zlib) | MIT |
55
+ | [`buffer`](https://npmjs.com/package/buffer) | MIT |
56
+ | [`constants-browserify`](https://npmjs.com/package/constants-browserify) | MIT |
57
+ | [`crypto-browserify`](https://npmjs.com/package/crypto-browserify) | MIT |
58
+ | [`domain-browser`](https://npmjs.com/package/domain-browser) | MIT |
59
+ | [`events`](https://npmjs.com/package/events) | MIT |
60
+ | [`https-browserify`](https://npmjs.com/package/https-browserify) | MIT |
61
+ | [`os-browserify`](https://npmjs.com/package/os-browserify) | MIT |
62
+ | [`path-browserify`](https://npmjs.com/package/path-browserify) | MIT |
63
+ | [`process`](https://npmjs.com/package/process) | MIT |
64
+ | [`punycode`](https://npmjs.com/package/punycode) | MIT |
65
+ | [`querystring-es3`](https://npmjs.com/package/querystring-es3) | MIT |
66
+ | [`stream-browserify`](https://npmjs.com/package/stream-browserify) | MIT |
67
+ | [`stream-http`](https://npmjs.com/package/stream-http) | MIT |
68
+ | [`string_decoder`](https://npmjs.com/package/string_decoder) | MIT |
69
+ | [`timers-browserify`](https://npmjs.com/package/timers-browserify) | MIT |
70
+ | [`tty-browserify`](https://npmjs.com/package/tty-browserify) | MIT |
71
+ | [`url`](https://npmjs.com/package/url) | MIT |
72
+ | [`util`](https://npmjs.com/package/util) | MIT |
73
+ | [`vm-browserify`](https://npmjs.com/package/vm-browserify) | MIT |
74
+
75
+ ## Additional credits
76
+
77
+ - Bun's JS transpiler, CSS lexer, and Node.js module resolver source code is a Zig port of [@evanw](https://github.com/evanw)’s [esbuild](https://github.com/evanw/esbuild) project.
78
+ - Credit to [@kipply](https://github.com/kipply) for the name "Bun"!
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Roadmap
3
+ description: Bun's roadmap and long-term plans
4
+ ---
5
+
6
+ Bun is a project with an incredibly large scope and is still in its early days. Long-term, Bun aims to provide an all-in-one toolkit to replace the complex, fragmented toolchains common today: Node.js, Jest, Webpack, esbuild, Babel, yarn, PostCSS, etc.
7
+
8
+ Refer to [Bun's Roadmap](https://github.com/oven-sh/bun/issues/159) on GitHub to learn more about the project's long-term plans and priorities.