bun-types 1.3.2-canary.20251104T140728 → 1.3.2-canary.20251106T140813

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 (312) hide show
  1. package/bun.d.ts +4 -4
  2. package/docs/README.md +28 -0
  3. package/globals.d.ts +0 -1
  4. package/overrides.d.ts +45 -15
  5. package/package.json +1 -1
  6. package/test.d.ts +1 -1
  7. package/docs/api/binary-data.md +0 -1038
  8. package/docs/api/cc.md +0 -197
  9. package/docs/api/color.md +0 -262
  10. package/docs/api/console.md +0 -57
  11. package/docs/api/cookie.md +0 -449
  12. package/docs/api/dns.md +0 -110
  13. package/docs/api/fetch.md +0 -463
  14. package/docs/api/ffi.md +0 -557
  15. package/docs/api/file-io.md +0 -366
  16. package/docs/api/file-system-router.md +0 -112
  17. package/docs/api/file.md +0 -19
  18. package/docs/api/glob.md +0 -178
  19. package/docs/api/globals.md +0 -387
  20. package/docs/api/hashing.md +0 -319
  21. package/docs/api/html-rewriter.md +0 -334
  22. package/docs/api/http.md +0 -1408
  23. package/docs/api/import-meta.md +0 -69
  24. package/docs/api/node-api.md +0 -14
  25. package/docs/api/redis.md +0 -597
  26. package/docs/api/s3.md +0 -850
  27. package/docs/api/secrets.md +0 -319
  28. package/docs/api/semver.md +0 -52
  29. package/docs/api/spawn.md +0 -582
  30. package/docs/api/sql.md +0 -1374
  31. package/docs/api/sqlite.md +0 -694
  32. package/docs/api/streams.md +0 -230
  33. package/docs/api/tcp.md +0 -221
  34. package/docs/api/transpiler.md +0 -276
  35. package/docs/api/udp.md +0 -123
  36. package/docs/api/utils.md +0 -891
  37. package/docs/api/websockets.md +0 -573
  38. package/docs/api/workers.md +0 -322
  39. package/docs/api/yaml.md +0 -668
  40. package/docs/benchmarks.md +0 -120
  41. package/docs/bun-flavored-toml.md +0 -42
  42. package/docs/bundler/css.md +0 -1028
  43. package/docs/bundler/css_modules.md +0 -145
  44. package/docs/bundler/executables.md +0 -626
  45. package/docs/bundler/fullstack.md +0 -418
  46. package/docs/bundler/hmr.md +0 -234
  47. package/docs/bundler/html.md +0 -349
  48. package/docs/bundler/index.md +0 -1735
  49. package/docs/bundler/intro.md +0 -75
  50. package/docs/bundler/loaders.md +0 -410
  51. package/docs/bundler/macros.md +0 -329
  52. package/docs/bundler/plugins.md +0 -449
  53. package/docs/bundler/vs-esbuild.md +0 -1127
  54. package/docs/cli/add.md +0 -173
  55. package/docs/cli/bun-completions.md +0 -3
  56. package/docs/cli/bun-create.md +0 -338
  57. package/docs/cli/bun-install.md +0 -349
  58. package/docs/cli/bun-upgrade.md +0 -39
  59. package/docs/cli/bunx.md +0 -89
  60. package/docs/cli/filter.md +0 -90
  61. package/docs/cli/info.md +0 -65
  62. package/docs/cli/init.md +0 -85
  63. package/docs/cli/install.md +0 -344
  64. package/docs/cli/link.md +0 -40
  65. package/docs/cli/outdated.md +0 -90
  66. package/docs/cli/patch-commit.md +0 -11
  67. package/docs/cli/pm.md +0 -285
  68. package/docs/cli/publish.md +0 -120
  69. package/docs/cli/remove.md +0 -7
  70. package/docs/cli/run.md +0 -261
  71. package/docs/cli/test.md +0 -397
  72. package/docs/cli/unlink.md +0 -9
  73. package/docs/cli/update.md +0 -129
  74. package/docs/cli/why.md +0 -67
  75. package/docs/contributing/upgrading-webkit.md +0 -57
  76. package/docs/ecosystem/elysia.md +0 -24
  77. package/docs/ecosystem/express.md +0 -37
  78. package/docs/ecosystem/hono.md +0 -18
  79. package/docs/ecosystem/react.md +0 -65
  80. package/docs/ecosystem/stric.md +0 -38
  81. package/docs/guides/binary/arraybuffer-to-array.md +0 -27
  82. package/docs/guides/binary/arraybuffer-to-blob.md +0 -24
  83. package/docs/guides/binary/arraybuffer-to-buffer.md +0 -25
  84. package/docs/guides/binary/arraybuffer-to-string.md +0 -15
  85. package/docs/guides/binary/arraybuffer-to-typedarray.md +0 -39
  86. package/docs/guides/binary/blob-to-arraybuffer.md +0 -14
  87. package/docs/guides/binary/blob-to-dataview.md +0 -14
  88. package/docs/guides/binary/blob-to-stream.md +0 -14
  89. package/docs/guides/binary/blob-to-string.md +0 -15
  90. package/docs/guides/binary/blob-to-typedarray.md +0 -14
  91. package/docs/guides/binary/buffer-to-arraybuffer.md +0 -14
  92. package/docs/guides/binary/buffer-to-blob.md +0 -14
  93. package/docs/guides/binary/buffer-to-readablestream.md +0 -41
  94. package/docs/guides/binary/buffer-to-string.md +0 -25
  95. package/docs/guides/binary/buffer-to-typedarray.md +0 -14
  96. package/docs/guides/binary/dataview-to-string.md +0 -15
  97. package/docs/guides/binary/typedarray-to-arraybuffer.md +0 -25
  98. package/docs/guides/binary/typedarray-to-blob.md +0 -16
  99. package/docs/guides/binary/typedarray-to-buffer.md +0 -14
  100. package/docs/guides/binary/typedarray-to-dataview.md +0 -14
  101. package/docs/guides/binary/typedarray-to-readablestream.md +0 -41
  102. package/docs/guides/binary/typedarray-to-string.md +0 -16
  103. package/docs/guides/deployment/railway.md +0 -157
  104. package/docs/guides/ecosystem/astro.md +0 -72
  105. package/docs/guides/ecosystem/discordjs.md +0 -77
  106. package/docs/guides/ecosystem/docker.md +0 -140
  107. package/docs/guides/ecosystem/drizzle.md +0 -185
  108. package/docs/guides/ecosystem/edgedb.md +0 -228
  109. package/docs/guides/ecosystem/elysia.md +0 -31
  110. package/docs/guides/ecosystem/express.md +0 -40
  111. package/docs/guides/ecosystem/hono.md +0 -39
  112. package/docs/guides/ecosystem/mongoose.md +0 -87
  113. package/docs/guides/ecosystem/neon-drizzle.md +0 -220
  114. package/docs/guides/ecosystem/neon-serverless-postgres.md +0 -55
  115. package/docs/guides/ecosystem/nextjs.md +0 -49
  116. package/docs/guides/ecosystem/nuxt.md +0 -56
  117. package/docs/guides/ecosystem/pm2.md +0 -57
  118. package/docs/guides/ecosystem/prisma.md +0 -141
  119. package/docs/guides/ecosystem/qwik.md +0 -107
  120. package/docs/guides/ecosystem/react.md +0 -50
  121. package/docs/guides/ecosystem/remix.md +0 -78
  122. package/docs/guides/ecosystem/render.md +0 -79
  123. package/docs/guides/ecosystem/sentry.md +0 -52
  124. package/docs/guides/ecosystem/solidstart.md +0 -58
  125. package/docs/guides/ecosystem/ssr-react.md +0 -51
  126. package/docs/guides/ecosystem/stric.md +0 -55
  127. package/docs/guides/ecosystem/sveltekit.md +0 -125
  128. package/docs/guides/ecosystem/systemd.md +0 -113
  129. package/docs/guides/ecosystem/vite.md +0 -71
  130. package/docs/guides/html-rewriter/extract-links.md +0 -68
  131. package/docs/guides/html-rewriter/extract-social-meta.md +0 -93
  132. package/docs/guides/http/cluster.md +0 -66
  133. package/docs/guides/http/fetch-unix.md +0 -33
  134. package/docs/guides/http/fetch.md +0 -24
  135. package/docs/guides/http/file-uploads.md +0 -94
  136. package/docs/guides/http/hot.md +0 -26
  137. package/docs/guides/http/proxy.md +0 -24
  138. package/docs/guides/http/server.md +0 -46
  139. package/docs/guides/http/simple.md +0 -18
  140. package/docs/guides/http/stream-file.md +0 -48
  141. package/docs/guides/http/stream-iterator.md +0 -47
  142. package/docs/guides/http/stream-node-streams-in-bun.md +0 -20
  143. package/docs/guides/http/tls.md +0 -30
  144. package/docs/guides/install/add-dev.md +0 -26
  145. package/docs/guides/install/add-git.md +0 -36
  146. package/docs/guides/install/add-optional.md +0 -25
  147. package/docs/guides/install/add-peer.md +0 -43
  148. package/docs/guides/install/add-tarball.md +0 -33
  149. package/docs/guides/install/add.md +0 -42
  150. package/docs/guides/install/azure-artifacts.md +0 -73
  151. package/docs/guides/install/cicd.md +0 -41
  152. package/docs/guides/install/custom-registry.md +0 -30
  153. package/docs/guides/install/from-npm-install-to-bun-install.md +0 -214
  154. package/docs/guides/install/git-diff-bun-lockfile.md +0 -44
  155. package/docs/guides/install/jfrog-artifactory.md +0 -28
  156. package/docs/guides/install/npm-alias.md +0 -23
  157. package/docs/guides/install/registry-scope.md +0 -38
  158. package/docs/guides/install/trusted.md +0 -46
  159. package/docs/guides/install/workspaces.md +0 -70
  160. package/docs/guides/install/yarnlock.md +0 -44
  161. package/docs/guides/process/argv.md +0 -58
  162. package/docs/guides/process/ctrl-c.md +0 -16
  163. package/docs/guides/process/ipc.md +0 -66
  164. package/docs/guides/process/nanoseconds.md +0 -13
  165. package/docs/guides/process/os-signals.md +0 -39
  166. package/docs/guides/process/spawn-stderr.md +0 -31
  167. package/docs/guides/process/spawn-stdout.md +0 -26
  168. package/docs/guides/process/spawn.md +0 -41
  169. package/docs/guides/process/stdin.md +0 -54
  170. package/docs/guides/read-file/arraybuffer.md +0 -28
  171. package/docs/guides/read-file/buffer.md +0 -19
  172. package/docs/guides/read-file/exists.md +0 -16
  173. package/docs/guides/read-file/json.md +0 -17
  174. package/docs/guides/read-file/mime.md +0 -20
  175. package/docs/guides/read-file/stream.md +0 -26
  176. package/docs/guides/read-file/string.md +0 -22
  177. package/docs/guides/read-file/uint8array.md +0 -21
  178. package/docs/guides/read-file/watch.md +0 -68
  179. package/docs/guides/runtime/build-time-constants.md +0 -293
  180. package/docs/guides/runtime/cicd.md +0 -43
  181. package/docs/guides/runtime/codesign-macos-executable.md +0 -56
  182. package/docs/guides/runtime/define-constant.md +0 -145
  183. package/docs/guides/runtime/delete-directory.md +0 -37
  184. package/docs/guides/runtime/delete-file.md +0 -19
  185. package/docs/guides/runtime/heap-snapshot.md +0 -26
  186. package/docs/guides/runtime/import-html.md +0 -15
  187. package/docs/guides/runtime/import-json.md +0 -44
  188. package/docs/guides/runtime/import-toml.md +0 -30
  189. package/docs/guides/runtime/import-yaml.md +0 -102
  190. package/docs/guides/runtime/read-env.md +0 -32
  191. package/docs/guides/runtime/set-env.md +0 -47
  192. package/docs/guides/runtime/shell.md +0 -40
  193. package/docs/guides/runtime/timezone.md +0 -35
  194. package/docs/guides/runtime/tsconfig-paths.md +0 -29
  195. package/docs/guides/runtime/typescript.md +0 -49
  196. package/docs/guides/runtime/vscode-debugger.md +0 -47
  197. package/docs/guides/runtime/web-debugger.md +0 -82
  198. package/docs/guides/streams/node-readable-to-arraybuffer.md +0 -11
  199. package/docs/guides/streams/node-readable-to-blob.md +0 -11
  200. package/docs/guides/streams/node-readable-to-json.md +0 -12
  201. package/docs/guides/streams/node-readable-to-string.md +0 -12
  202. package/docs/guides/streams/node-readable-to-uint8array.md +0 -11
  203. package/docs/guides/streams/to-array.md +0 -14
  204. package/docs/guides/streams/to-arraybuffer.md +0 -14
  205. package/docs/guides/streams/to-blob.md +0 -14
  206. package/docs/guides/streams/to-buffer.md +0 -15
  207. package/docs/guides/streams/to-json.md +0 -14
  208. package/docs/guides/streams/to-string.md +0 -14
  209. package/docs/guides/streams/to-typedarray.md +0 -22
  210. package/docs/guides/test/bail.md +0 -22
  211. package/docs/guides/test/coverage-threshold.md +0 -60
  212. package/docs/guides/test/coverage.md +0 -44
  213. package/docs/guides/test/happy-dom.md +0 -68
  214. package/docs/guides/test/migrate-from-jest.md +0 -143
  215. package/docs/guides/test/mock-clock.md +0 -48
  216. package/docs/guides/test/mock-functions.md +0 -68
  217. package/docs/guides/test/rerun-each.md +0 -14
  218. package/docs/guides/test/run-tests.md +0 -111
  219. package/docs/guides/test/skip-tests.md +0 -39
  220. package/docs/guides/test/snapshot.md +0 -95
  221. package/docs/guides/test/spy-on.md +0 -46
  222. package/docs/guides/test/svelte-test.md +0 -120
  223. package/docs/guides/test/testing-library.md +0 -92
  224. package/docs/guides/test/timeout.md +0 -15
  225. package/docs/guides/test/todo-tests.md +0 -67
  226. package/docs/guides/test/update-snapshots.md +0 -46
  227. package/docs/guides/test/watch-mode.md +0 -19
  228. package/docs/guides/util/base64.md +0 -15
  229. package/docs/guides/util/deep-equals.md +0 -39
  230. package/docs/guides/util/deflate.md +0 -18
  231. package/docs/guides/util/detect-bun.md +0 -23
  232. package/docs/guides/util/entrypoint.md +0 -17
  233. package/docs/guides/util/escape-html.md +0 -22
  234. package/docs/guides/util/file-url-to-path.md +0 -14
  235. package/docs/guides/util/gzip.md +0 -18
  236. package/docs/guides/util/hash-a-password.md +0 -54
  237. package/docs/guides/util/import-meta-dir.md +0 -13
  238. package/docs/guides/util/import-meta-file.md +0 -13
  239. package/docs/guides/util/import-meta-path.md +0 -13
  240. package/docs/guides/util/javascript-uuid.md +0 -23
  241. package/docs/guides/util/main.md +0 -32
  242. package/docs/guides/util/path-to-file-url.md +0 -14
  243. package/docs/guides/util/sleep.md +0 -22
  244. package/docs/guides/util/version.md +0 -21
  245. package/docs/guides/util/which-path-to-executable-bin.md +0 -15
  246. package/docs/guides/websocket/compression.md +0 -31
  247. package/docs/guides/websocket/context.md +0 -77
  248. package/docs/guides/websocket/pubsub.md +0 -41
  249. package/docs/guides/websocket/simple.md +0 -33
  250. package/docs/guides/write-file/append.md +0 -52
  251. package/docs/guides/write-file/basic.md +0 -44
  252. package/docs/guides/write-file/blob.md +0 -28
  253. package/docs/guides/write-file/cat.md +0 -17
  254. package/docs/guides/write-file/file-cp.md +0 -16
  255. package/docs/guides/write-file/filesink.md +0 -52
  256. package/docs/guides/write-file/response.md +0 -17
  257. package/docs/guides/write-file/stdout.md +0 -21
  258. package/docs/guides/write-file/stream.md +0 -17
  259. package/docs/guides/write-file/unlink.md +0 -16
  260. package/docs/index.md +0 -77
  261. package/docs/install/audit.md +0 -57
  262. package/docs/install/cache.md +0 -59
  263. package/docs/install/catalogs.md +0 -298
  264. package/docs/install/index.md +0 -248
  265. package/docs/install/isolated.md +0 -197
  266. package/docs/install/lifecycle.md +0 -46
  267. package/docs/install/lockfile.md +0 -58
  268. package/docs/install/npmrc.md +0 -105
  269. package/docs/install/overrides.md +0 -73
  270. package/docs/install/patch.md +0 -59
  271. package/docs/install/registries.md +0 -30
  272. package/docs/install/security-scanner-api.md +0 -81
  273. package/docs/install/workspaces.md +0 -114
  274. package/docs/installation.md +0 -327
  275. package/docs/project/asan.md +0 -124
  276. package/docs/project/benchmarking.md +0 -203
  277. package/docs/project/bindgen.md +0 -225
  278. package/docs/project/building-windows.md +0 -162
  279. package/docs/project/contributing.md +0 -347
  280. package/docs/project/internals/build-process-for-ci.md +0 -75
  281. package/docs/project/licensing.md +0 -73
  282. package/docs/project/roadmap.md +0 -87
  283. package/docs/quickstart.md +0 -157
  284. package/docs/runtime/autoimport.md +0 -94
  285. package/docs/runtime/bun-apis.md +0 -207
  286. package/docs/runtime/bunfig.md +0 -772
  287. package/docs/runtime/debugger.md +0 -325
  288. package/docs/runtime/env.md +0 -253
  289. package/docs/runtime/hot.md +0 -145
  290. package/docs/runtime/index.md +0 -312
  291. package/docs/runtime/jsx.md +0 -385
  292. package/docs/runtime/loaders.md +0 -130
  293. package/docs/runtime/modules.md +0 -320
  294. package/docs/runtime/nodejs-apis.md +0 -463
  295. package/docs/runtime/plugins.md +0 -561
  296. package/docs/runtime/shell.md +0 -605
  297. package/docs/runtime/typescript.md +0 -139
  298. package/docs/runtime/web-apis.md +0 -128
  299. package/docs/test/configuration.md +0 -154
  300. package/docs/test/coverage.md +0 -142
  301. package/docs/test/discovery.md +0 -85
  302. package/docs/test/dom.md +0 -75
  303. package/docs/test/examples/concurrent-test-glob.md +0 -132
  304. package/docs/test/hot.md +0 -15
  305. package/docs/test/lifecycle.md +0 -81
  306. package/docs/test/mocks.md +0 -313
  307. package/docs/test/reporters.md +0 -117
  308. package/docs/test/runtime-behavior.md +0 -95
  309. package/docs/test/snapshots.md +0 -68
  310. package/docs/test/time.md +0 -126
  311. package/docs/test/writing.md +0 -825
  312. package/docs/typescript.md +0 -53
@@ -1,73 +0,0 @@
1
- Bun supports npm's `"overrides"` and Yarn's `"resolutions"` in `package.json`. These are mechanisms for specifying a version range for _metadependencies_—the dependencies of your dependencies.
2
-
3
- ```json-diff#package.json
4
- {
5
- "name": "my-app",
6
- "dependencies": {
7
- "foo": "^2.0.0"
8
- },
9
- + "overrides": {
10
- + "bar": "~4.4.0"
11
- + }
12
- }
13
- ```
14
-
15
- By default, Bun will install the latest version of all dependencies and metadependencies, according to the ranges specified in each package's `package.json`. Let's say you have a project with one dependency, `foo`, which in turn has a dependency on `bar`. This means `bar` is a _metadependency_ of our project.
16
-
17
- ```json#package.json
18
- {
19
- "name": "my-app",
20
- "dependencies": {
21
- "foo": "^2.0.0"
22
- }
23
- }
24
- ```
25
-
26
- When you run `bun install`, Bun will install the latest versions of each package.
27
-
28
- ```
29
- # tree layout of node_modules
30
- node_modules
31
- ├── foo@1.2.3
32
- └── bar@4.5.6
33
- ```
34
-
35
- But what if a security vulnerability was introduced in `bar@4.5.6`? We may want a way to pin `bar` to an older version that doesn't have the vulnerability. This is where `"overrides"`/`"resolutions"` come in.
36
-
37
- ## `"overrides"`
38
-
39
- Add `bar` to the `"overrides"` field in `package.json`. Bun will defer to the specified version range when determining which version of `bar` to install, whether it's a dependency or a metadependency.
40
-
41
- {% callout %}
42
- **Note** — Bun currently only supports top-level `"overrides"`. [Nested overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides) are not supported.
43
- {% /callout %}
44
-
45
- ```json-diff#package.json
46
- {
47
- "name": "my-app",
48
- "dependencies": {
49
- "foo": "^2.0.0"
50
- },
51
- + "overrides": {
52
- + "bar": "~4.4.0"
53
- + }
54
- }
55
- ```
56
-
57
- ## `"resolutions"`
58
-
59
- The syntax is similar for `"resolutions"`, which is Yarn's alternative to `"overrides"`. Bun supports this feature to make migration from Yarn easier.
60
-
61
- As with `"overrides"`, _nested resolutions_ are not currently supported.
62
-
63
- ```json-diff#package.json
64
- {
65
- "name": "my-app",
66
- "dependencies": {
67
- "foo": "^2.0.0"
68
- },
69
- + "resolutions": {
70
- + "bar": "~4.4.0"
71
- + }
72
- }
73
- ```
@@ -1,59 +0,0 @@
1
- `bun patch` lets you persistently patch node_modules in a maintainable, git-friendly way.
2
-
3
- Sometimes, you need to make a small change to a package in `node_modules/` to fix a bug or add a feature. `bun patch` makes it easy to do this without vendoring the entire package and reuse the patch across multiple installs, multiple projects, and multiple machines.
4
-
5
- Features:
6
-
7
- - Generates `.patch` files applied to dependencies in `node_modules` on install
8
- - `.patch` files can be committed to your repository, reused across multiple installs, projects, and machines
9
- - `"patchedDependencies"` in `package.json` keeps track of patched packages
10
- - `bun patch` lets you patch packages in `node_modules/` while preserving the integrity of Bun's [Global Cache](https://bun.com/docs/install/cache)
11
- - Test your changes locally before committing them with `bun patch --commit <pkg>`
12
- - To preserve disk space and keep `bun install` fast, patched packages are committed to the Global Cache and shared across projects where possible
13
-
14
- #### Step 1. Prepare the package for patching
15
-
16
- To get started, use `bun patch <pkg>` to prepare the package for patching:
17
-
18
- ```bash
19
- # you can supply the package name
20
- $ bun patch react
21
-
22
- # ...and a precise version in case multiple versions are installed
23
- $ bun patch react@17.0.2
24
-
25
- # or the path to the package
26
- $ bun patch node_modules/react
27
- ```
28
-
29
- {% callout %}
30
- **Note** — Don't forget to call `bun patch <pkg>`! This ensures the package folder in `node_modules/` contains a fresh copy of the package with no symlinks/hardlinks to Bun's cache.
31
-
32
- If you forget to do this, you might end up editing the package globally in the cache!
33
- {% /callout %}
34
-
35
- #### Step 2. Test your changes locally
36
-
37
- `bun patch <pkg>` makes it safe to edit the `<pkg>` in `node_modules/` directly, while preserving the integrity of Bun's [Global Cache](https://bun.com/docs/install/cache). This works by re-creating an unlinked clone of the package in `node_modules/` and diffing it against the original package in the Global Cache.
38
-
39
- #### Step 3. Commit your changes
40
-
41
- Once you're happy with your changes, run `bun patch --commit <path or pkg>`.
42
-
43
- Bun will generate a patch file in `patches/`, update your `package.json` and lockfile, and Bun will start using the patched package:
44
-
45
- ```bash
46
- # you can supply the path to the patched package
47
- $ bun patch --commit node_modules/react
48
-
49
- # ... or the package name and optionally the version
50
- $ bun patch --commit react@17.0.2
51
-
52
- # choose the directory to store the patch files
53
- $ bun patch --commit react --patches-dir=mypatches
54
-
55
- # `patch-commit` is available for compatibility with pnpm
56
- $ bun patch-commit react
57
- ```
58
-
59
- {% bunCLIUsage command="patch" /%}
@@ -1,30 +0,0 @@
1
- The default registry is `registry.npmjs.org`. This can be globally configured in `bunfig.toml`:
2
-
3
- ```toml
4
- [install]
5
- # set default registry as a string
6
- registry = "https://registry.npmjs.org"
7
- # set a token
8
- registry = { url = "https://registry.npmjs.org", token = "123456" }
9
- # set a username/password
10
- registry = "https://username:password@registry.npmjs.org"
11
- ```
12
-
13
- To configure a private registry scoped to a particular organization:
14
-
15
- ```toml
16
- [install.scopes]
17
- # registry as string
18
- "@myorg1" = "https://username:password@registry.myorg.com/"
19
-
20
- # registry with username/password
21
- # you can reference environment variables
22
- "@myorg2" = { username = "myusername", password = "$NPM_PASS", url = "https://registry.myorg.com/" }
23
-
24
- # registry with token
25
- "@myorg3" = { token = "$npm_token", url = "https://registry.myorg.com/" }
26
- ```
27
-
28
- ### `.npmrc`
29
-
30
- Bun also reads `.npmrc` files, [learn more](https://bun.com/docs/install/npmrc).
@@ -1,81 +0,0 @@
1
- Bun's package manager can scan packages for security vulnerabilities before installation, helping protect your applications from supply chain attacks and known vulnerabilities.
2
-
3
- ## Quick Start
4
-
5
- Configure a security scanner in your `bunfig.toml`:
6
-
7
- ```toml
8
- [install.security]
9
- scanner = "@acme/bun-security-scanner"
10
- ```
11
-
12
- When configured, Bun will:
13
-
14
- - Scan all packages before installation
15
- - Display security warnings and advisories
16
- - Cancel installation if critical vulnerabilities are found
17
- - Automatically disable auto-install for security
18
-
19
- ## How It Works
20
-
21
- Security scanners analyze packages during `bun install`, `bun add`, and other package operations. They can detect:
22
-
23
- - Known security vulnerabilities (CVEs)
24
- - Malicious packages
25
- - License compliance issues
26
- - ...and more!
27
-
28
- ### Security Levels
29
-
30
- Scanners report issues at two severity levels:
31
-
32
- - **`fatal`** - Installation stops immediately, exits with non-zero code
33
- - **`warn`** - In interactive terminals, prompts to continue; in CI, exits immediately
34
-
35
- ## Using Pre-built Scanners
36
-
37
- Many security companies publish Bun security scanners as npm packages that you can install and use immediately.
38
-
39
- ### Installing a Scanner
40
-
41
- Install a security scanner from npm:
42
-
43
- ```bash
44
- $ bun add -d @acme/bun-security-scanner
45
- ```
46
-
47
- > **Note:** Consult your security scanner's documentation for their specific package name and installation instructions. Most scanners will be installed with `bun add`.
48
-
49
- ### Configuring the Scanner
50
-
51
- After installation, configure it in your `bunfig.toml`:
52
-
53
- ```toml
54
- [install.security]
55
- scanner = "@acme/bun-security-scanner"
56
- ```
57
-
58
- ### Enterprise Configuration
59
-
60
- Some enterprise scanners might support authentication and/or configuration through environment variables:
61
-
62
- ```bash
63
- # This might go in ~/.bashrc, for example
64
- export SECURITY_API_KEY="your-api-key"
65
-
66
- # The scanner will now use these credentials automatically
67
- bun install
68
- ```
69
-
70
- Consult your security scanner's documentation to learn which environment variables to set and if any additional configuration is required.
71
-
72
- ### Authoring your own scanner
73
-
74
- For a complete example with tests and CI setup, see the official template:
75
- [github.com/oven-sh/security-scanner-template](https://github.com/oven-sh/security-scanner-template)
76
-
77
- ## Related
78
-
79
- - [Configuration (bunfig.toml)](/docs/runtime/bunfig#install-security-scanner)
80
- - [Package Manager](/docs/install)
81
- - [Security Scanner Template](https://github.com/oven-sh/security-scanner-template)
@@ -1,114 +0,0 @@
1
- Bun supports [`workspaces`](https://docs.npmjs.com/cli/v9/using-npm/workspaces?v=true#description) in `package.json`. Workspaces make it easy to develop complex software as a _monorepo_ consisting of several independent packages.
2
-
3
- It's common for a monorepo to have the following structure:
4
-
5
- ```
6
- tree
7
- <root>
8
- ├── README.md
9
- ├── bun.lock
10
- ├── package.json
11
- ├── tsconfig.json
12
- └── packages
13
-    ├── pkg-a
14
-    │   ├── index.ts
15
-    │   ├── package.json
16
-    │   └── tsconfig.json
17
-    ├── pkg-b
18
-    │   ├── index.ts
19
-    │   ├── package.json
20
-    │   └── tsconfig.json
21
-    └── pkg-c
22
-    ├── index.ts
23
-    ├── package.json
24
-    └── tsconfig.json
25
- ```
26
-
27
- In the root `package.json`, the `"workspaces"` key is used to indicate which subdirectories should be considered packages/workspaces within the monorepo. It's conventional to place all the workspace in a directory called `packages`.
28
-
29
- ```json
30
- {
31
- "name": "my-project",
32
- "version": "1.0.0",
33
- "workspaces": ["packages/*"],
34
- "devDependencies": {
35
- "example-package-in-monorepo": "workspace:*"
36
- }
37
- }
38
- ```
39
-
40
- {% callout %}
41
- **Glob support** — Bun supports full glob syntax in `"workspaces"`, including negative patterns (e.g. `!**/excluded/**`). See [here](https://bun.com/docs/api/glob#supported-glob-patterns) for a comprehensive list of supported syntax.
42
- {% /callout %}
43
-
44
- ```json
45
- {
46
- "name": "my-project",
47
- "version": "1.0.0",
48
- "workspaces": [
49
- "packages/**",
50
- "!packages/**/test/**",
51
- "!packages/**/template/**"
52
- ]
53
- }
54
- ```
55
-
56
- Each workspace has it's own `package.json`. When referencing other packages in the monorepo, semver or workspace protocols (e.g. `workspace:*`) can be used as the version field in your `package.json`.
57
-
58
- ```json
59
- {
60
- "name": "pkg-a",
61
- "version": "1.0.0",
62
- "dependencies": {
63
- "pkg-b": "workspace:*"
64
- }
65
- }
66
- ```
67
-
68
- `bun install` will install dependencies for all workspaces in the monorepo, de-duplicating packages if possible. If you only want to install dependencies for specific workspaces, you can use the `--filter` flag.
69
-
70
- ```bash
71
- # Install dependencies for all workspaces starting with `pkg-` except for `pkg-c`
72
- $ bun install --filter "pkg-*" --filter "!pkg-c"
73
-
74
- # Paths can also be used. This is equivalent to the command above.
75
- $ bun install --filter "./packages/pkg-*" --filter "!pkg-c" # or --filter "!./packages/pkg-c"
76
- ```
77
-
78
- When publishing, `workspace:` versions are replaced by the package's `package.json` version,
79
-
80
- ```
81
- "workspace:*" -> "1.0.1"
82
- "workspace:^" -> "^1.0.1"
83
- "workspace:~" -> "~1.0.1"
84
- ```
85
-
86
- Setting a specific version takes precedence over the package's `package.json` version,
87
-
88
- ```
89
- "workspace:1.0.2" -> "1.0.2" // Even if current version is 1.0.1
90
- ```
91
-
92
- Workspaces have a couple major benefits.
93
-
94
- - **Code can be split into logical parts.** If one package relies on another, you can simply add it as a dependency in `package.json`. If package `b` depends on `a`, `bun install` will install your local `packages/a` directory into `node_modules` instead of downloading it from the npm registry.
95
- - **Dependencies can be de-duplicated.** If `a` and `b` share a common dependency, it will be _hoisted_ to the root `node_modules` directory. This reduces redundant disk usage and minimizes "dependency hell" issues associated with having multiple versions of a package installed simultaneously.
96
- - **Run scripts in multiple packages.** You can use the [`--filter` flag](https://bun.com/docs/cli/filter) to easily run `package.json` scripts in multiple packages in your workspace, or `--workspaces` to run scripts across all workspaces.
97
-
98
- ## Share versions with Catalogs
99
-
100
- When many packages need the same dependency versions, catalogs let you define
101
- those versions once in the root `package.json` and reference them from your
102
- workspaces using the `catalog:` protocol. Updating the catalog automatically
103
- updates every package that references it. See
104
- [Catalogs](https://bun.com/docs/install/catalogs) for details.
105
-
106
- {% callout %}
107
- ⚡️ **Speed** — Installs are fast, even for big monorepos. Bun installs the [Remix](https://github.com/remix-run/remix) monorepo in about `500ms` on Linux.
108
-
109
- - 28x faster than `npm install`
110
- - 12x faster than `yarn install` (v1)
111
- - 8x faster than `pnpm install`
112
-
113
- {% image src="https://user-images.githubusercontent.com/709451/212829600-77df9544-7c9f-4d8d-a984-b2cd0fd2aa52.png" /%}
114
- {% /callout %}
@@ -1,327 +0,0 @@
1
- Bun ships as a single executable with no dependencies that can be installed a few different ways.
2
-
3
- ## Installing
4
-
5
- ### macOS and Linux
6
-
7
- {% callout %}
8
- **Linux users** — The `unzip` package is required to install Bun. Use `sudo apt install unzip` to install `unzip` package.
9
- Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Use `uname -r` to check Kernel version.
10
- {% /callout %}
11
-
12
- {% codetabs %}
13
-
14
- ```bash#macOS/Linux_(curl)
15
- $ curl -fsSL https://bun.com/install | bash # for macOS, Linux, and WSL
16
- # to install a specific version
17
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.3.2-canary.20251104T140728"
18
- ```
19
-
20
- ```bash#npm
21
- $ npm install -g bun # the last `npm` command you'll ever need
22
- ```
23
-
24
- ```bash#Homebrew
25
- $ brew install oven-sh/bun/bun # for macOS and Linux
26
- ```
27
-
28
- ```bash#Docker
29
- $ docker pull oven/bun
30
- $ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
31
- ```
32
-
33
- {% /codetabs %}
34
-
35
- ### Windows
36
-
37
- To install, paste this into a terminal:
38
-
39
- {% codetabs %}
40
-
41
- ```powershell#PowerShell/cmd.exe
42
- > powershell -c "irm bun.sh/install.ps1|iex"
43
- ```
44
-
45
- ```powershell#npm
46
- > npm install -g bun # the last `npm` command you'll ever need
47
- ```
48
-
49
- ```powershell#Scoop
50
- > scoop install bun
51
- ```
52
-
53
- {% /codetabs %}
54
-
55
- {% callout %}
56
- Bun requires a minimum of Windows 10 version 1809
57
- {% /callout %}
58
-
59
- For support and discussion, please join the [#windows channel on our Discord](http://bun.com/discord).
60
-
61
- ## Docker
62
-
63
- Bun provides a [Docker image](https://hub.docker.com/r/oven/bun/tags) that supports both Linux x64 and arm64.
64
-
65
- ```bash
66
- $ docker pull oven/bun
67
- $ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
68
- ```
69
-
70
- There are also image variants for different operating systems.
71
-
72
- ```bash
73
- $ docker pull oven/bun:debian
74
- $ docker pull oven/bun:slim
75
- $ docker pull oven/bun:distroless
76
- $ docker pull oven/bun:alpine
77
- ```
78
-
79
- ## Checking installation
80
-
81
- To check that Bun was installed successfully, open a new terminal window and run `bun --version`.
82
-
83
- ```sh
84
- $ bun --version
85
- 1.x.y
86
- ```
87
-
88
- To see the precise commit of [oven-sh/bun](https://github.com/oven-sh/bun) that you're using, run `bun --revision`.
89
-
90
- ```sh
91
- $ bun --revision
92
- 1.x.y+b7982ac13189
93
- ```
94
-
95
- If you've installed Bun but are seeing a `command not found` error, you may have to manually add the installation directory (`~/.bun/bin`) to your `PATH`.
96
-
97
- ### How to add your `PATH`
98
-
99
- {% details summary="Linux / Mac" %}
100
- First, determine what shell you're using:
101
-
102
- ```sh
103
- $ echo $SHELL
104
- /bin/zsh # or /bin/bash or /bin/fish
105
- ```
106
-
107
- Then add these lines below to bottom of your shell's configuration file.
108
-
109
- {% codetabs %}
110
-
111
- ```bash#~/.zshrc
112
- # add to ~/.zshrc
113
- export BUN_INSTALL="$HOME/.bun"
114
- export PATH="$BUN_INSTALL/bin:$PATH"
115
- ```
116
-
117
- ```bash#~/.bashrc
118
- # add to ~/.bashrc
119
- export BUN_INSTALL="$HOME/.bun"
120
- export PATH="$BUN_INSTALL/bin:$PATH"
121
- ```
122
-
123
- ```sh#~/.config/fish/config.fish
124
- # add to ~/.config/fish/config.fish
125
- export BUN_INSTALL="$HOME/.bun"
126
- export PATH="$BUN_INSTALL/bin:$PATH"
127
- ```
128
-
129
- {% /codetabs %}
130
- Save the file. You'll need to open a new shell/terminal window for the changes to take effect.
131
-
132
- {% /details %}
133
-
134
- {% details summary="Windows" %}
135
- First, determine if the bun binary is properly installed on your system:
136
-
137
- ```pwsh
138
- & "$env:USERPROFILE\.bun\bin\bun" --version
139
- ```
140
-
141
- If the command runs successfully but `bun --version` is not recognized, it means that bun is not in your system's `PATH`. To fix this, open a Powershell terminal and run the following command:
142
-
143
- ```pwsh
144
- [System.Environment]::SetEnvironmentVariable(
145
- "Path",
146
- [System.Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.bun\bin",
147
- [System.EnvironmentVariableTarget]::User
148
- )
149
- ```
150
-
151
- After running the command, restart your terminal and test with `bun --version`
152
-
153
- {% /details %}
154
-
155
- ## Upgrading
156
-
157
- Once installed, the binary can upgrade itself.
158
-
159
- ```sh
160
- $ bun upgrade
161
- ```
162
-
163
- {% callout %}
164
- **Homebrew users** — To avoid conflicts with Homebrew, use `brew upgrade bun` instead.
165
-
166
- **Scoop users** — To avoid conflicts with Scoop, use `scoop update bun` instead.
167
-
168
- {% /callout %}
169
-
170
- ## Canary builds
171
-
172
- Bun automatically releases an (untested) canary build on every commit to `main`. To upgrade to the latest canary build:
173
-
174
- ```sh
175
- $ bun upgrade --canary
176
- ```
177
-
178
- The canary build is useful for testing new features and bug fixes before they're released in a stable build. To help the Bun team fix bugs faster, canary builds automatically upload crash reports to Bun's team.
179
-
180
- [View canary build](https://github.com/oven-sh/bun/releases/tag/canary)
181
-
182
- {% callout %}
183
- **Note** — To switch back to a stable release from canary, run `bun upgrade --stable`.
184
- {% /callout %}
185
-
186
- ## Installing older versions of Bun
187
-
188
- Since Bun is a single binary, you can install older versions of Bun by re-running the installer script with a specific version.
189
-
190
- ### Installing a specific version of Bun on Linux/Mac
191
-
192
- To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.3.2-canary.20251104T140728`.
193
-
194
- ```sh
195
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.3.2-canary.20251104T140728"
196
- ```
197
-
198
- ### Installing a specific version of Bun on Windows
199
-
200
- On Windows, you can install a specific version of Bun by passing the version number to the Powershell install script.
201
-
202
- ```sh
203
- # PowerShell:
204
- $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.3.2-canary.20251104T140728"
205
- ```
206
-
207
- ## Downloading Bun binaries directly
208
-
209
- To download Bun binaries directly, you can visit the [releases page](https://github.com/oven-sh/bun/releases) on GitHub.
210
-
211
- For convenience, here are download links for the latest version:
212
-
213
- - [`bun-linux-x64.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip)
214
- - [`bun-linux-x64-baseline.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-baseline.zip)
215
- - [`bun-linux-x64-musl.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-musl.zip)
216
- - [`bun-linux-x64-musl-baseline.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-musl-baseline.zip)
217
- - [`bun-windows-x64.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-windows-x64.zip)
218
- - [`bun-windows-x64-baseline.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-windows-x64-baseline.zip)
219
- - [`bun-darwin-aarch64.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-darwin-aarch64.zip)
220
- - [`bun-linux-aarch64.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-aarch64.zip)
221
- - [`bun-linux-aarch64-musl.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-aarch64-musl.zip)
222
- - [`bun-darwin-x64.zip`](https://github.com/oven-sh/bun/releases/latest/download/bun-darwin-x64.zip)
223
-
224
- The `musl` binaries are built for distributions that do not ship with the glibc libraries by default, instead relying on musl. The two most popular distros are Void Linux and Alpine Linux, with the latter is used heavily in Docker containers. If you encounter an error like the following: `bun: /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.29' not found (required by bun)`, try using the musl binary. Bun's install script automatically chooses the correct binary for your system.
225
-
226
- ### CPU requirements and `baseline` builds
227
-
228
- Bun's `x64` binaries target the Haswell CPU architecture, which means they require AVX and AVX2 instructions. For Linux and Windows, the `x64-baseline` binaries are also available which target the Nehalem architecture. If you run into an "Illegal Instruction" error when running Bun, try using the `baseline` binaries instead. Bun's install script automatically chooses the correct binary for your system which helps avoid this issue. Baseline builds are slower than regular builds, so use them only if necessary.
229
-
230
- | Build | Intel requirement | AMD requirement |
231
- | ------------ | ------------------------------------------------------------------ | ------------------ |
232
- | x64 | Haswell (4th generation Core) or newer, except some low-end models | Excavator or newer |
233
- | x64-baseline | Nehalem (1st generation Core) or newer | Bulldozer or newer |
234
-
235
- Bun does not currently support any CPUs older than the `baseline` target, which mandates the SSE4.2 extension.
236
-
237
- Bun also publishes `darwin-x64-baseline` binaries, but these are just a copy of the `darwin-x64` ones so they still have the same CPU requirement. We only maintain these since some tools expect them to exist. Bun requires macOS 13.0 or later, which does not support any CPUs that don't meet our requirement.
238
-
239
- <!--
240
- ## Native
241
-
242
- Works on macOS x64 & Silicon, Linux x64, Windows Subsystem for Linux.
243
-
244
- ```sh
245
- $ curl -fsSL https://bun.com/install | bash
246
- ```
247
-
248
- Once installed, the binary can upgrade itself.
249
-
250
- ```sh
251
- $ bun upgrade
252
- ```
253
-
254
- Bun automatically releases an (untested) canary build on every commit to `main`. To upgrade to the latest canary build:
255
-
256
- ```sh
257
- $ bun upgrade --canary
258
- ```
259
-
260
- ## Homebrew
261
-
262
- Works on macOS and Linux
263
-
264
- ```sh
265
- $ brew tap oven-sh/bun
266
- $ brew install bun
267
- ```
268
-
269
- Homebrew recommends using `brew upgrade <package>` to install newer versions.
270
-
271
- ## Docker
272
-
273
- Works on Linux x64
274
-
275
- ```sh
276
- # this is a comment
277
- $ docker pull oven/bun:edge
278
- this is some output
279
- $ docker run --rm --init --ulimit memlock=-1:-1 oven/bun:edge
280
- $ docker run --rm --init --ulimit memlock=-1:-1 oven/bun:edge
281
- this is some output
282
- ``` -->
283
-
284
- <!-- ## Completions
285
-
286
- Shell auto-completion should be configured automatically when Bun is installed!
287
-
288
- If not, run the following command. It uses `$SHELL` to determine which shell you're using and writes a completion file to the appropriate place on disk. It's automatically re-run on every `bun upgrade`.
289
-
290
- ```bash
291
- $ bun completions
292
- ```
293
-
294
- To write the completions to a custom location:
295
-
296
- ```bash
297
- $ bun completions > path-to-file # write to file
298
- $ bun completions /path/to/directory # write into directory
299
- ``` -->
300
-
301
- ## Uninstall
302
-
303
- If you need to remove Bun from your system, use the following commands.
304
-
305
- {% codetabs %}
306
-
307
- ```bash#macOS/Linux_(curl)
308
- $ rm -rf ~/.bun # for macOS, Linux, and WSL
309
- ```
310
-
311
- ```powershell#Windows
312
- > powershell -c ~\.bun\uninstall.ps1
313
- ```
314
-
315
- ```powershell#Scoop
316
- > scoop uninstall bun
317
- ```
318
-
319
- ```bash#npm
320
- $ npm uninstall -g bun
321
- ```
322
-
323
- ```bash#Homebrew
324
- $ brew uninstall bun
325
- ```
326
-
327
- {% /codetabs %}