bun-types 1.3.2-canary.20251105T140650 → 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.
- package/docs/README.md +28 -0
- package/package.json +1 -1
- package/docs/api/binary-data.md +0 -1038
- package/docs/api/cc.md +0 -197
- package/docs/api/color.md +0 -262
- package/docs/api/console.md +0 -57
- package/docs/api/cookie.md +0 -449
- package/docs/api/dns.md +0 -110
- package/docs/api/fetch.md +0 -463
- package/docs/api/ffi.md +0 -557
- package/docs/api/file-io.md +0 -366
- package/docs/api/file-system-router.md +0 -112
- package/docs/api/file.md +0 -19
- package/docs/api/glob.md +0 -178
- package/docs/api/globals.md +0 -387
- package/docs/api/hashing.md +0 -319
- package/docs/api/html-rewriter.md +0 -334
- package/docs/api/http.md +0 -1408
- package/docs/api/import-meta.md +0 -69
- package/docs/api/node-api.md +0 -14
- package/docs/api/redis.md +0 -597
- package/docs/api/s3.md +0 -850
- package/docs/api/secrets.md +0 -319
- package/docs/api/semver.md +0 -52
- package/docs/api/spawn.md +0 -582
- package/docs/api/sql.md +0 -1374
- package/docs/api/sqlite.md +0 -694
- package/docs/api/streams.md +0 -230
- package/docs/api/tcp.md +0 -221
- package/docs/api/transpiler.md +0 -276
- package/docs/api/udp.md +0 -123
- package/docs/api/utils.md +0 -891
- package/docs/api/websockets.md +0 -573
- package/docs/api/workers.md +0 -322
- package/docs/api/yaml.md +0 -668
- package/docs/benchmarks.md +0 -120
- package/docs/bun-flavored-toml.md +0 -42
- package/docs/bundler/css.md +0 -1028
- package/docs/bundler/css_modules.md +0 -145
- package/docs/bundler/executables.md +0 -626
- package/docs/bundler/fullstack.md +0 -418
- package/docs/bundler/hmr.md +0 -234
- package/docs/bundler/html.md +0 -349
- package/docs/bundler/index.md +0 -1735
- package/docs/bundler/intro.md +0 -75
- package/docs/bundler/loaders.md +0 -410
- package/docs/bundler/macros.md +0 -329
- package/docs/bundler/plugins.md +0 -449
- package/docs/bundler/vs-esbuild.md +0 -1127
- package/docs/cli/add.md +0 -173
- package/docs/cli/bun-completions.md +0 -3
- package/docs/cli/bun-create.md +0 -338
- package/docs/cli/bun-install.md +0 -349
- package/docs/cli/bun-upgrade.md +0 -39
- package/docs/cli/bunx.md +0 -89
- package/docs/cli/filter.md +0 -90
- package/docs/cli/info.md +0 -65
- package/docs/cli/init.md +0 -85
- package/docs/cli/install.md +0 -344
- package/docs/cli/link.md +0 -40
- package/docs/cli/outdated.md +0 -90
- package/docs/cli/patch-commit.md +0 -11
- package/docs/cli/pm.md +0 -285
- package/docs/cli/publish.md +0 -120
- package/docs/cli/remove.md +0 -7
- package/docs/cli/run.md +0 -261
- package/docs/cli/test.md +0 -397
- package/docs/cli/unlink.md +0 -9
- package/docs/cli/update.md +0 -129
- package/docs/cli/why.md +0 -67
- package/docs/contributing/upgrading-webkit.md +0 -57
- package/docs/ecosystem/elysia.md +0 -24
- package/docs/ecosystem/express.md +0 -37
- package/docs/ecosystem/hono.md +0 -18
- package/docs/ecosystem/react.md +0 -65
- package/docs/ecosystem/stric.md +0 -38
- package/docs/guides/binary/arraybuffer-to-array.md +0 -27
- package/docs/guides/binary/arraybuffer-to-blob.md +0 -24
- package/docs/guides/binary/arraybuffer-to-buffer.md +0 -25
- package/docs/guides/binary/arraybuffer-to-string.md +0 -15
- package/docs/guides/binary/arraybuffer-to-typedarray.md +0 -39
- package/docs/guides/binary/blob-to-arraybuffer.md +0 -14
- package/docs/guides/binary/blob-to-dataview.md +0 -14
- package/docs/guides/binary/blob-to-stream.md +0 -14
- package/docs/guides/binary/blob-to-string.md +0 -15
- package/docs/guides/binary/blob-to-typedarray.md +0 -14
- package/docs/guides/binary/buffer-to-arraybuffer.md +0 -14
- package/docs/guides/binary/buffer-to-blob.md +0 -14
- package/docs/guides/binary/buffer-to-readablestream.md +0 -41
- package/docs/guides/binary/buffer-to-string.md +0 -25
- package/docs/guides/binary/buffer-to-typedarray.md +0 -14
- package/docs/guides/binary/dataview-to-string.md +0 -15
- package/docs/guides/binary/typedarray-to-arraybuffer.md +0 -25
- package/docs/guides/binary/typedarray-to-blob.md +0 -16
- package/docs/guides/binary/typedarray-to-buffer.md +0 -14
- package/docs/guides/binary/typedarray-to-dataview.md +0 -14
- package/docs/guides/binary/typedarray-to-readablestream.md +0 -41
- package/docs/guides/binary/typedarray-to-string.md +0 -16
- package/docs/guides/deployment/railway.md +0 -157
- package/docs/guides/ecosystem/astro.md +0 -72
- package/docs/guides/ecosystem/discordjs.md +0 -77
- package/docs/guides/ecosystem/docker.md +0 -140
- package/docs/guides/ecosystem/drizzle.md +0 -185
- package/docs/guides/ecosystem/edgedb.md +0 -228
- package/docs/guides/ecosystem/elysia.md +0 -31
- package/docs/guides/ecosystem/express.md +0 -40
- package/docs/guides/ecosystem/hono.md +0 -39
- package/docs/guides/ecosystem/mongoose.md +0 -87
- package/docs/guides/ecosystem/neon-drizzle.md +0 -220
- package/docs/guides/ecosystem/neon-serverless-postgres.md +0 -55
- package/docs/guides/ecosystem/nextjs.md +0 -49
- package/docs/guides/ecosystem/nuxt.md +0 -56
- package/docs/guides/ecosystem/pm2.md +0 -57
- package/docs/guides/ecosystem/prisma.md +0 -141
- package/docs/guides/ecosystem/qwik.md +0 -107
- package/docs/guides/ecosystem/react.md +0 -50
- package/docs/guides/ecosystem/remix.md +0 -78
- package/docs/guides/ecosystem/render.md +0 -79
- package/docs/guides/ecosystem/sentry.md +0 -52
- package/docs/guides/ecosystem/solidstart.md +0 -58
- package/docs/guides/ecosystem/ssr-react.md +0 -51
- package/docs/guides/ecosystem/stric.md +0 -55
- package/docs/guides/ecosystem/sveltekit.md +0 -125
- package/docs/guides/ecosystem/systemd.md +0 -113
- package/docs/guides/ecosystem/vite.md +0 -71
- package/docs/guides/html-rewriter/extract-links.md +0 -68
- package/docs/guides/html-rewriter/extract-social-meta.md +0 -93
- package/docs/guides/http/cluster.md +0 -66
- package/docs/guides/http/fetch-unix.md +0 -33
- package/docs/guides/http/fetch.md +0 -24
- package/docs/guides/http/file-uploads.md +0 -94
- package/docs/guides/http/hot.md +0 -26
- package/docs/guides/http/proxy.md +0 -24
- package/docs/guides/http/server.md +0 -46
- package/docs/guides/http/simple.md +0 -18
- package/docs/guides/http/stream-file.md +0 -48
- package/docs/guides/http/stream-iterator.md +0 -47
- package/docs/guides/http/stream-node-streams-in-bun.md +0 -20
- package/docs/guides/http/tls.md +0 -30
- package/docs/guides/install/add-dev.md +0 -26
- package/docs/guides/install/add-git.md +0 -36
- package/docs/guides/install/add-optional.md +0 -25
- package/docs/guides/install/add-peer.md +0 -43
- package/docs/guides/install/add-tarball.md +0 -33
- package/docs/guides/install/add.md +0 -42
- package/docs/guides/install/azure-artifacts.md +0 -73
- package/docs/guides/install/cicd.md +0 -41
- package/docs/guides/install/custom-registry.md +0 -30
- package/docs/guides/install/from-npm-install-to-bun-install.md +0 -214
- package/docs/guides/install/git-diff-bun-lockfile.md +0 -44
- package/docs/guides/install/jfrog-artifactory.md +0 -28
- package/docs/guides/install/npm-alias.md +0 -23
- package/docs/guides/install/registry-scope.md +0 -38
- package/docs/guides/install/trusted.md +0 -46
- package/docs/guides/install/workspaces.md +0 -70
- package/docs/guides/install/yarnlock.md +0 -44
- package/docs/guides/process/argv.md +0 -58
- package/docs/guides/process/ctrl-c.md +0 -16
- package/docs/guides/process/ipc.md +0 -66
- package/docs/guides/process/nanoseconds.md +0 -13
- package/docs/guides/process/os-signals.md +0 -39
- package/docs/guides/process/spawn-stderr.md +0 -31
- package/docs/guides/process/spawn-stdout.md +0 -26
- package/docs/guides/process/spawn.md +0 -41
- package/docs/guides/process/stdin.md +0 -54
- package/docs/guides/read-file/arraybuffer.md +0 -28
- package/docs/guides/read-file/buffer.md +0 -19
- package/docs/guides/read-file/exists.md +0 -16
- package/docs/guides/read-file/json.md +0 -17
- package/docs/guides/read-file/mime.md +0 -20
- package/docs/guides/read-file/stream.md +0 -26
- package/docs/guides/read-file/string.md +0 -22
- package/docs/guides/read-file/uint8array.md +0 -21
- package/docs/guides/read-file/watch.md +0 -68
- package/docs/guides/runtime/build-time-constants.md +0 -293
- package/docs/guides/runtime/cicd.md +0 -43
- package/docs/guides/runtime/codesign-macos-executable.md +0 -56
- package/docs/guides/runtime/define-constant.md +0 -145
- package/docs/guides/runtime/delete-directory.md +0 -37
- package/docs/guides/runtime/delete-file.md +0 -19
- package/docs/guides/runtime/heap-snapshot.md +0 -26
- package/docs/guides/runtime/import-html.md +0 -15
- package/docs/guides/runtime/import-json.md +0 -44
- package/docs/guides/runtime/import-toml.md +0 -30
- package/docs/guides/runtime/import-yaml.md +0 -102
- package/docs/guides/runtime/read-env.md +0 -32
- package/docs/guides/runtime/set-env.md +0 -47
- package/docs/guides/runtime/shell.md +0 -40
- package/docs/guides/runtime/timezone.md +0 -35
- package/docs/guides/runtime/tsconfig-paths.md +0 -29
- package/docs/guides/runtime/typescript.md +0 -49
- package/docs/guides/runtime/vscode-debugger.md +0 -47
- package/docs/guides/runtime/web-debugger.md +0 -82
- package/docs/guides/streams/node-readable-to-arraybuffer.md +0 -11
- package/docs/guides/streams/node-readable-to-blob.md +0 -11
- package/docs/guides/streams/node-readable-to-json.md +0 -12
- package/docs/guides/streams/node-readable-to-string.md +0 -12
- package/docs/guides/streams/node-readable-to-uint8array.md +0 -11
- package/docs/guides/streams/to-array.md +0 -14
- package/docs/guides/streams/to-arraybuffer.md +0 -14
- package/docs/guides/streams/to-blob.md +0 -14
- package/docs/guides/streams/to-buffer.md +0 -15
- package/docs/guides/streams/to-json.md +0 -14
- package/docs/guides/streams/to-string.md +0 -14
- package/docs/guides/streams/to-typedarray.md +0 -22
- package/docs/guides/test/bail.md +0 -22
- package/docs/guides/test/coverage-threshold.md +0 -60
- package/docs/guides/test/coverage.md +0 -44
- package/docs/guides/test/happy-dom.md +0 -68
- package/docs/guides/test/migrate-from-jest.md +0 -143
- package/docs/guides/test/mock-clock.md +0 -48
- package/docs/guides/test/mock-functions.md +0 -68
- package/docs/guides/test/rerun-each.md +0 -14
- package/docs/guides/test/run-tests.md +0 -111
- package/docs/guides/test/skip-tests.md +0 -39
- package/docs/guides/test/snapshot.md +0 -95
- package/docs/guides/test/spy-on.md +0 -46
- package/docs/guides/test/svelte-test.md +0 -120
- package/docs/guides/test/testing-library.md +0 -92
- package/docs/guides/test/timeout.md +0 -15
- package/docs/guides/test/todo-tests.md +0 -67
- package/docs/guides/test/update-snapshots.md +0 -46
- package/docs/guides/test/watch-mode.md +0 -19
- package/docs/guides/util/base64.md +0 -15
- package/docs/guides/util/deep-equals.md +0 -39
- package/docs/guides/util/deflate.md +0 -18
- package/docs/guides/util/detect-bun.md +0 -23
- package/docs/guides/util/entrypoint.md +0 -17
- package/docs/guides/util/escape-html.md +0 -22
- package/docs/guides/util/file-url-to-path.md +0 -14
- package/docs/guides/util/gzip.md +0 -18
- package/docs/guides/util/hash-a-password.md +0 -54
- package/docs/guides/util/import-meta-dir.md +0 -13
- package/docs/guides/util/import-meta-file.md +0 -13
- package/docs/guides/util/import-meta-path.md +0 -13
- package/docs/guides/util/javascript-uuid.md +0 -23
- package/docs/guides/util/main.md +0 -32
- package/docs/guides/util/path-to-file-url.md +0 -14
- package/docs/guides/util/sleep.md +0 -22
- package/docs/guides/util/version.md +0 -21
- package/docs/guides/util/which-path-to-executable-bin.md +0 -15
- package/docs/guides/websocket/compression.md +0 -31
- package/docs/guides/websocket/context.md +0 -77
- package/docs/guides/websocket/pubsub.md +0 -41
- package/docs/guides/websocket/simple.md +0 -33
- package/docs/guides/write-file/append.md +0 -52
- package/docs/guides/write-file/basic.md +0 -44
- package/docs/guides/write-file/blob.md +0 -28
- package/docs/guides/write-file/cat.md +0 -17
- package/docs/guides/write-file/file-cp.md +0 -16
- package/docs/guides/write-file/filesink.md +0 -52
- package/docs/guides/write-file/response.md +0 -17
- package/docs/guides/write-file/stdout.md +0 -21
- package/docs/guides/write-file/stream.md +0 -17
- package/docs/guides/write-file/unlink.md +0 -16
- package/docs/index.md +0 -77
- package/docs/install/audit.md +0 -57
- package/docs/install/cache.md +0 -59
- package/docs/install/catalogs.md +0 -298
- package/docs/install/index.md +0 -248
- package/docs/install/isolated.md +0 -197
- package/docs/install/lifecycle.md +0 -46
- package/docs/install/lockfile.md +0 -58
- package/docs/install/npmrc.md +0 -105
- package/docs/install/overrides.md +0 -73
- package/docs/install/patch.md +0 -59
- package/docs/install/registries.md +0 -30
- package/docs/install/security-scanner-api.md +0 -81
- package/docs/install/workspaces.md +0 -114
- package/docs/installation.md +0 -327
- package/docs/project/asan.md +0 -124
- package/docs/project/benchmarking.md +0 -203
- package/docs/project/bindgen.md +0 -225
- package/docs/project/building-windows.md +0 -162
- package/docs/project/contributing.md +0 -347
- package/docs/project/internals/build-process-for-ci.md +0 -75
- package/docs/project/licensing.md +0 -73
- package/docs/project/roadmap.md +0 -87
- package/docs/quickstart.md +0 -157
- package/docs/runtime/autoimport.md +0 -94
- package/docs/runtime/bun-apis.md +0 -207
- package/docs/runtime/bunfig.md +0 -772
- package/docs/runtime/debugger.md +0 -325
- package/docs/runtime/env.md +0 -253
- package/docs/runtime/hot.md +0 -145
- package/docs/runtime/index.md +0 -312
- package/docs/runtime/jsx.md +0 -385
- package/docs/runtime/loaders.md +0 -130
- package/docs/runtime/modules.md +0 -320
- package/docs/runtime/nodejs-apis.md +0 -463
- package/docs/runtime/plugins.md +0 -561
- package/docs/runtime/shell.md +0 -605
- package/docs/runtime/typescript.md +0 -139
- package/docs/runtime/web-apis.md +0 -128
- package/docs/test/configuration.md +0 -154
- package/docs/test/coverage.md +0 -142
- package/docs/test/discovery.md +0 -85
- package/docs/test/dom.md +0 -75
- package/docs/test/examples/concurrent-test-glob.md +0 -132
- package/docs/test/hot.md +0 -15
- package/docs/test/lifecycle.md +0 -81
- package/docs/test/mocks.md +0 -313
- package/docs/test/reporters.md +0 -117
- package/docs/test/runtime-behavior.md +0 -95
- package/docs/test/snapshots.md +0 -68
- package/docs/test/time.md +0 -126
- package/docs/test/writing.md +0 -825
- package/docs/typescript.md +0 -53
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
This document describes the build process for Windows. If you run into problems, please join the [#contributing channel on our Discord](http://bun.com/discord) for help.
|
|
2
|
-
|
|
3
|
-
It is strongly recommended to use [PowerShell 7 (`pwsh.exe`)](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4) instead of the default `powershell.exe`.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
<!--
|
|
8
|
-
{% details summary="Extra notes for Bun Core Team Members" %}
|
|
9
|
-
|
|
10
|
-
Here are the extra steps I ran on my fresh windows machine (some of these are a little opiniated)
|
|
11
|
-
|
|
12
|
-
- Change user to a local account (set username to `window` and 'bun!')
|
|
13
|
-
- Set Windows Terminal as default terminal
|
|
14
|
-
- Install latest version of Powershell
|
|
15
|
-
- Display scale to 100%
|
|
16
|
-
- Remove McAfee and enable Windows Defender (default antivirus, does not nag you)
|
|
17
|
-
- Install Software
|
|
18
|
-
- OpenSSH server (run these in an elevated terminal)
|
|
19
|
-
- `Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0`
|
|
20
|
-
- `Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0`
|
|
21
|
-
- `Start-Service sshd`
|
|
22
|
-
- `Set-Service -Name sshd -StartupType 'Automatic'`
|
|
23
|
-
- `New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force`
|
|
24
|
-
- Configure in `C:\ProgramData\ssh`
|
|
25
|
-
- Add ssh keys (in ProgramData because it is an admin account)
|
|
26
|
-
- Tailscale (login with GitHub so it joins the team tailnet)
|
|
27
|
-
- Visual Studio Code
|
|
28
|
-
- Configure `git`
|
|
29
|
-
- `git config user.name "your name"`
|
|
30
|
-
- `git config user.email "your@email"`
|
|
31
|
-
- Disable sleep mode and the lid switch by going to "Power Options" and configuring everything there.
|
|
32
|
-
|
|
33
|
-
I recommend using VSCode through SSH instead of Tunnels or the Tailscale extension, it seems to be more reliable.
|
|
34
|
-
|
|
35
|
-
{% /details %} -->
|
|
36
|
-
|
|
37
|
-
### Enable Scripts
|
|
38
|
-
|
|
39
|
-
By default, running unverified scripts are blocked.
|
|
40
|
-
|
|
41
|
-
```ps1
|
|
42
|
-
> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### System Dependencies
|
|
46
|
-
|
|
47
|
-
Bun v1.1 or later. We use Bun to run it's own code generators.
|
|
48
|
-
|
|
49
|
-
```ps1
|
|
50
|
-
> irm bun.com/install.ps1 | iex
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
[Visual Studio](https://visualstudio.microsoft.com) with the "Desktop Development with C++" workload. While installing, make sure to install Git as well, if Git for Windows is not already installed.
|
|
54
|
-
|
|
55
|
-
Visual Studio can be installed graphically using the wizard or through WinGet:
|
|
56
|
-
|
|
57
|
-
```ps1
|
|
58
|
-
> winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Git " -s msstore
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
After Visual Studio, you need the following:
|
|
62
|
-
|
|
63
|
-
- LLVM 19.1.7
|
|
64
|
-
- Go
|
|
65
|
-
- Rust
|
|
66
|
-
- NASM
|
|
67
|
-
- Perl
|
|
68
|
-
- Ruby
|
|
69
|
-
- Node.js
|
|
70
|
-
- Ccache
|
|
71
|
-
|
|
72
|
-
{% callout %}
|
|
73
|
-
**Note** – The Zig compiler is automatically downloaded, installed, and updated by the building process.
|
|
74
|
-
{% /callout %}
|
|
75
|
-
|
|
76
|
-
[Scoop](https://scoop.sh) can be used to install these remaining tools easily.
|
|
77
|
-
|
|
78
|
-
{% codetabs group="a" %}
|
|
79
|
-
|
|
80
|
-
```ps1#Scoop
|
|
81
|
-
> irm https://get.scoop.sh | iex
|
|
82
|
-
> scoop install nodejs-lts go rust nasm ruby perl ccache
|
|
83
|
-
# scoop seems to be buggy if you install llvm and the rest at the same time
|
|
84
|
-
> scoop install llvm@19.1.7
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
{% /codetabs %}
|
|
88
|
-
|
|
89
|
-
{% callout %}
|
|
90
|
-
Please do not use WinGet/other package manager for these, as you will likely install Strawberry Perl instead of a more minimal installation of Perl. Strawberry Perl includes many other utilities that get installed into `$Env:PATH` that will conflict with MSVC and break the build.
|
|
91
|
-
{% /callout %}
|
|
92
|
-
|
|
93
|
-
If you intend on building WebKit locally (optional), you should install these packages:
|
|
94
|
-
|
|
95
|
-
```ps1#Scoop
|
|
96
|
-
> scoop install make cygwin python
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
From here on out, it is **expected you use a PowerShell Terminal with `.\scripts\vs-shell.ps1` sourced**. This script is available in the Bun repository and can be loaded by executing it:
|
|
100
|
-
|
|
101
|
-
```ps1
|
|
102
|
-
> .\scripts\vs-shell.ps1
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
To verify, you can check for an MSVC-only command line such as `mt.exe`
|
|
106
|
-
|
|
107
|
-
```ps1
|
|
108
|
-
> Get-Command mt
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
{% callout %}
|
|
112
|
-
It is not recommended to install `ninja` / `cmake` into your global path, because you may run into a situation where you try to build bun without .\scripts\vs-shell.ps1 sourced.
|
|
113
|
-
{% /callout %}
|
|
114
|
-
|
|
115
|
-
## Building
|
|
116
|
-
|
|
117
|
-
```ps1
|
|
118
|
-
> bun run build
|
|
119
|
-
|
|
120
|
-
# after the initial `bun run build` you can use the following to build
|
|
121
|
-
> ninja -Cbuild/debug
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
If this was successful, you should have a `bun-debug.exe` in the `build/debug` folder.
|
|
125
|
-
|
|
126
|
-
```ps1
|
|
127
|
-
> .\build\debug\bun-debug.exe --revision
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
You should add this to `$Env:PATH`. The simplest way to do so is to open the start menu, type "Path", and then navigate the environment variables menu to add `C:\.....\bun\build\debug` to the user environment variable `PATH`. You should then restart your editor (if it does not update still, log out and log back in).
|
|
131
|
-
|
|
132
|
-
## Extra paths
|
|
133
|
-
|
|
134
|
-
- WebKit is extracted to `build/debug/cache/webkit/`
|
|
135
|
-
- Zig is extracted to `build/debug/cache/zig/bin/zig.exe`
|
|
136
|
-
|
|
137
|
-
## Tests
|
|
138
|
-
|
|
139
|
-
You can run the test suite either using `bun test <path>` or by using the wrapper script `bun node:test <path>`. The `bun node:test` command runs every test file in a separate instance of bun.exe, to prevent a crash in the test runner from stopping the entire suite.
|
|
140
|
-
|
|
141
|
-
```ps1
|
|
142
|
-
# Setup
|
|
143
|
-
> bun i --cwd packages\bun-internal-test
|
|
144
|
-
|
|
145
|
-
# Run the entire test suite with reporter
|
|
146
|
-
# the package.json script "test" uses "build/debug/bun-debug.exe" by default
|
|
147
|
-
> bun run test
|
|
148
|
-
|
|
149
|
-
# Run an individual test file:
|
|
150
|
-
> bun-debug test node\fs
|
|
151
|
-
> bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js"
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Troubleshooting
|
|
155
|
-
|
|
156
|
-
### .rc file fails to build
|
|
157
|
-
|
|
158
|
-
`llvm-rc.exe` is odd. don't use it. use `rc.exe`, to do this make sure you are in a visual studio dev terminal, check `rc /?` to ensure it is `Microsoft Resource Compiler`
|
|
159
|
-
|
|
160
|
-
### failed to write output 'bun-debug.exe': permission denied
|
|
161
|
-
|
|
162
|
-
you cannot overwrite `bun-debug.exe` if it is already open. you likely have a running instance, maybe in the vscode debugger?
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
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.
|
|
2
|
-
|
|
3
|
-
If you are using Windows, please refer to [this guide](https://bun.com/docs/project/building-windows)
|
|
4
|
-
|
|
5
|
-
## Using Nix (Alternative)
|
|
6
|
-
|
|
7
|
-
A Nix flake is provided as an alternative to manual dependency installation:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
nix develop
|
|
11
|
-
# or explicitly use the pure shell
|
|
12
|
-
# nix develop .#pure
|
|
13
|
-
export CMAKE_SYSTEM_PROCESSOR=$(uname -m)
|
|
14
|
-
bun bd
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
This provides all dependencies in an isolated, reproducible environment without requiring sudo.
|
|
18
|
-
|
|
19
|
-
## Install Dependencies (Manual)
|
|
20
|
-
|
|
21
|
-
Using your system's package manager, install Bun's dependencies:
|
|
22
|
-
|
|
23
|
-
{% codetabs group="os" %}
|
|
24
|
-
|
|
25
|
-
```bash#macOS (Homebrew)
|
|
26
|
-
$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
```bash#Ubuntu/Debian
|
|
30
|
-
$ 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
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
```bash#Arch
|
|
34
|
-
$ sudo pacman -S base-devel ccache cmake git go libiconv libtool make ninja pkg-config python rust sed unzip ruby
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
```bash#Fedora
|
|
38
|
-
$ sudo dnf install cargo clang19 llvm19 lld19 ccache cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```bash#openSUSE Tumbleweed
|
|
42
|
-
$ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
{% /codetabs %}
|
|
46
|
-
|
|
47
|
-
> **Note**: The Zig compiler is automatically installed and updated by the build scripts. Manual installation is not required.
|
|
48
|
-
|
|
49
|
-
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.
|
|
50
|
-
|
|
51
|
-
{% codetabs %}
|
|
52
|
-
|
|
53
|
-
```bash#Native
|
|
54
|
-
$ curl -fsSL https://bun.com/install | bash
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
```bash#npm
|
|
58
|
-
$ npm install -g bun
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```bash#Homebrew
|
|
62
|
-
$ brew tap oven-sh/bun
|
|
63
|
-
$ brew install bun
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
{% /codetabs %}
|
|
67
|
-
|
|
68
|
-
## Install LLVM
|
|
69
|
-
|
|
70
|
-
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:
|
|
71
|
-
|
|
72
|
-
{% codetabs group="os" %}
|
|
73
|
-
|
|
74
|
-
```bash#macOS (Homebrew)
|
|
75
|
-
$ brew install llvm@19
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
```bash#Ubuntu/Debian
|
|
79
|
-
$ # LLVM has an automatic installation script that is compatible with all versions of Ubuntu
|
|
80
|
-
$ wget https://apt.llvm.org/llvm.sh -O - | sudo bash -s -- 19 all
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```bash#Arch
|
|
84
|
-
$ sudo pacman -S llvm clang lld
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```bash#Fedora
|
|
88
|
-
$ sudo dnf install llvm clang lld-devel
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```bash#openSUSE Tumbleweed
|
|
92
|
-
$ sudo zypper install clang19 lld19 llvm19
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
{% /codetabs %}
|
|
96
|
-
|
|
97
|
-
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).
|
|
98
|
-
|
|
99
|
-
Make sure Clang/LLVM 19 is in your path:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
$ which clang-19
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
If not, run this to manually add it:
|
|
106
|
-
|
|
107
|
-
{% codetabs group="os" %}
|
|
108
|
-
|
|
109
|
-
```bash#macOS (Homebrew)
|
|
110
|
-
# use fish_add_path if you're using fish
|
|
111
|
-
# use path+="$(brew --prefix llvm@19)/bin" if you are using zsh
|
|
112
|
-
$ export PATH="$(brew --prefix llvm@19)/bin:$PATH"
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
```bash#Arch
|
|
116
|
-
# use fish_add_path if you're using fish
|
|
117
|
-
$ export PATH="$PATH:/usr/lib/llvm19/bin"
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
{% /codetabs %}
|
|
121
|
-
|
|
122
|
-
> ⚠️ 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.
|
|
123
|
-
|
|
124
|
-
## Building Bun
|
|
125
|
-
|
|
126
|
-
After cloning the repository, run the following command to build. This may take a while as it will clone submodules and build dependencies.
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
$ bun run build
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
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.
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
$ build/debug/bun-debug --version
|
|
136
|
-
x.y.z_debug
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## VSCode
|
|
140
|
-
|
|
141
|
-
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.
|
|
142
|
-
|
|
143
|
-
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).
|
|
144
|
-
|
|
145
|
-
We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-debug` in your terminal:
|
|
146
|
-
|
|
147
|
-
```sh
|
|
148
|
-
$ bun-debug
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Running debug builds
|
|
152
|
-
|
|
153
|
-
The `bd` package.json script compiles and runs a debug build of Bun, only printing the output of the build process if it fails.
|
|
154
|
-
|
|
155
|
-
```sh
|
|
156
|
-
$ bun bd <args>
|
|
157
|
-
$ bun bd test foo.test.ts
|
|
158
|
-
$ bun bd ./foo.ts
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
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:
|
|
162
|
-
|
|
163
|
-
- Batch up your changes
|
|
164
|
-
- 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)
|
|
165
|
-
- Prefer using the debugger ("CodeLLDB" in VSCode) to step through the code.
|
|
166
|
-
- Use debug logs. `BUN_DEBUG_<scope>=1` will enable debug logging for the corresponding `Output.scoped(.<scope>, .hidden)` 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.
|
|
167
|
-
- 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).
|
|
168
|
-
|
|
169
|
-
## Code generation scripts
|
|
170
|
-
|
|
171
|
-
Several code generation scripts are used during Bun's build process. These are run automatically when changes are made to certain files.
|
|
172
|
-
|
|
173
|
-
In particular, these are:
|
|
174
|
-
|
|
175
|
-
- `./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.
|
|
176
|
-
- `./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
|
|
177
|
-
- `./src/codegen/cppbind.ts` -- Generates automatic Zig bindings for C++ functions marked with `[[ZIG_EXPORT]]` attributes.
|
|
178
|
-
- `./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.
|
|
179
|
-
- `./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.
|
|
180
|
-
|
|
181
|
-
## Modifying ESM modules
|
|
182
|
-
|
|
183
|
-
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.
|
|
184
|
-
|
|
185
|
-
## Release build
|
|
186
|
-
|
|
187
|
-
To compile a release build of Bun, run:
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
$ bun run build:release
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
The binary will be located at `./build/release/bun` and `./build/release/bun-profile`.
|
|
194
|
-
|
|
195
|
-
### Download release build from pull requests
|
|
196
|
-
|
|
197
|
-
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.
|
|
198
|
-
|
|
199
|
-
To run a release build from a pull request, you can use the `bun-pr` npm package:
|
|
200
|
-
|
|
201
|
-
```sh
|
|
202
|
-
bunx bun-pr <pr-number>
|
|
203
|
-
bunx bun-pr <branch-name>
|
|
204
|
-
bunx bun-pr "https://github.com/oven-sh/bun/pull/1234566"
|
|
205
|
-
bunx bun-pr --asan <pr-number> # Linux x64 only
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
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}`.
|
|
209
|
-
|
|
210
|
-
```sh
|
|
211
|
-
bun-1234566 --version
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
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.
|
|
215
|
-
|
|
216
|
-
## AddressSanitizer
|
|
217
|
-
|
|
218
|
-
[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.
|
|
219
|
-
|
|
220
|
-
To build a release build with Address Sanitizer, run:
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
$ bun run build:release:asan
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
In CI, we run our test suite with at least one target that is built with Address Sanitizer.
|
|
227
|
-
|
|
228
|
-
## Building WebKit locally + Debug mode of JSC
|
|
229
|
-
|
|
230
|
-
WebKit is not cloned by default (to save time and disk space). To clone and build WebKit locally, run:
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
# Clone WebKit into ./vendor/WebKit
|
|
234
|
-
$ git clone https://github.com/oven-sh/WebKit vendor/WebKit
|
|
235
|
-
|
|
236
|
-
# Check out the commit hash specified in `set(WEBKIT_VERSION <commit_hash>)` in cmake/tools/SetupWebKit.cmake
|
|
237
|
-
$ git -C vendor/WebKit checkout <commit_hash>
|
|
238
|
-
|
|
239
|
-
# Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug
|
|
240
|
-
# Optionally, you can use `bun run jsc:build` for a release build
|
|
241
|
-
$ bun run jsc:build:debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
|
|
242
|
-
|
|
243
|
-
# After an initial run of `make jsc-debug`, you can rebuild JSC with:
|
|
244
|
-
$ cmake --build vendor/WebKit/WebKitBuild/Debug --target jsc && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
|
|
245
|
-
|
|
246
|
-
# Build bun with the local JSC build
|
|
247
|
-
$ bun run build:local
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
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:
|
|
251
|
-
|
|
252
|
-
- The first line in [`src/js/builtins.d.ts`](/src/js/builtins.d.ts)
|
|
253
|
-
- The `CompilationDatabase` line in [`.clangd` config](/.clangd) should be `CompilationDatabase: build/debug-local`
|
|
254
|
-
- In [`build.zig`](/build.zig), the `codegen_path` option should be `build/debug-local/codegen` (instead of `build/debug/codegen`)
|
|
255
|
-
- In [`.vscode/launch.json`](/.vscode/launch.json), many configurations use `./build/debug/`, change them as you see fit
|
|
256
|
-
|
|
257
|
-
Note that the WebKit folder, including build artifacts, is 8GB+ in size.
|
|
258
|
-
|
|
259
|
-
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.
|
|
260
|
-
|
|
261
|
-
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`](/cmake/tools/SetupWebKit.cmake) to point to the commit hash.
|
|
262
|
-
|
|
263
|
-
## Troubleshooting
|
|
264
|
-
|
|
265
|
-
### 'span' file not found on Ubuntu
|
|
266
|
-
|
|
267
|
-
> ⚠️ Please note that the instructions below are specific to issues occurring on Ubuntu. It is unlikely that the same issues will occur on other Linux distributions.
|
|
268
|
-
|
|
269
|
-
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.
|
|
270
|
-
|
|
271
|
-
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:
|
|
272
|
-
|
|
273
|
-
```
|
|
274
|
-
fatal error: 'span' file not found
|
|
275
|
-
#include <span>
|
|
276
|
-
^~~~~~
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
The issue may manifest when initially running `bun setup` as Clang being unable to compile a simple program:
|
|
280
|
-
|
|
281
|
-
```
|
|
282
|
-
The C++ compiler
|
|
283
|
-
|
|
284
|
-
"/usr/bin/clang++-19"
|
|
285
|
-
|
|
286
|
-
is not able to compile a simple test program.
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
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:
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
$ sudo apt update
|
|
293
|
-
$ sudo apt install gcc-11 g++-11
|
|
294
|
-
# If the above command fails with `Unable to locate package gcc-11` we need
|
|
295
|
-
# to add the APT repository
|
|
296
|
-
$ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
297
|
-
# Now run `apt install` again
|
|
298
|
-
$ sudo apt install gcc-11 g++-11
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Now, we need to set GCC 11 as the default compiler:
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
|
|
305
|
-
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### libarchive
|
|
309
|
-
|
|
310
|
-
If you see an error on macOS when compiling `libarchive`, run:
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
$ brew install pkg-config
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### macOS `library not found for -lSystem`
|
|
317
|
-
|
|
318
|
-
If you see this error when compiling, run:
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
$ xcode-select --install
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Cannot find `libatomic.a`
|
|
325
|
-
|
|
326
|
-
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:
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
$ bun run build -DUSE_STATIC_LIBATOMIC=OFF
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
The built version of Bun may not work on other systems if compiled this way.
|
|
333
|
-
|
|
334
|
-
### ccache conflicts with building TinyCC on macOS
|
|
335
|
-
|
|
336
|
-
If you run into issues with `ccache` when building TinyCC, try reinstalling ccache
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
brew uninstall ccache
|
|
340
|
-
brew install ccache
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
## Using bun-debug
|
|
344
|
-
|
|
345
|
-
- Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging)
|
|
346
|
-
- Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`)
|
|
347
|
-
- 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`
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
There are four parts to the CI build:
|
|
2
|
-
|
|
3
|
-
- Dependencies: should be cached across builds as much as possible, it depends on git submodule hashes
|
|
4
|
-
- Zig Object: depends on \*.zig and src/js
|
|
5
|
-
- C++ Object: depends on \*.cpp and src/js
|
|
6
|
-
- Linking: depends on the above three
|
|
7
|
-
|
|
8
|
-
Utilizing multiple GitHub Action runners allows us to do a lot of work in parallel.
|
|
9
|
-
|
|
10
|
-
## Dependencies
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
BUN_DEPS_OUT_DIR="/optional/out/dir" bash ./scripts/all-dependencies.sh
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Zig Object
|
|
17
|
-
|
|
18
|
-
This does not have a dependency on WebKit or any of the dependencies at all. It can be compiled without checking out submodules, but you will need to have bun install run. It can be very easily cross compiled. Note that the zig object is always `bun-zig.o`.
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
BUN_REPO=/path/to/oven-sh/bun
|
|
22
|
-
|
|
23
|
-
cd tmp1
|
|
24
|
-
|
|
25
|
-
cmake $BUN_REPO \
|
|
26
|
-
-G Ninja \
|
|
27
|
-
-DCMAKE_BUILD_TYPE=Release \
|
|
28
|
-
-DCPU_TARGET="native" \
|
|
29
|
-
-DZIG_TARGET="native" \
|
|
30
|
-
-DBUN_ZIG_OBJ_DIR="./build"
|
|
31
|
-
|
|
32
|
-
ninja ./build/bun-zig.o
|
|
33
|
-
# -> bun-zig.o
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## C++ Object
|
|
37
|
-
|
|
38
|
-
Note: if WEBKIT_DIR is not passed, it is automatically downloaded from GitHub releases. This depends on the headers from submodules but not necessarily the build copies of them, .a files, etc.
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
cd tmp2
|
|
42
|
-
|
|
43
|
-
cmake $BUN_REPO \
|
|
44
|
-
-G Ninja \
|
|
45
|
-
-DCMAKE_BUILD_TYPE=Release \
|
|
46
|
-
-DBUN_CPP_ONLY=1 \
|
|
47
|
-
|
|
48
|
-
bash compile-cpp-only.sh
|
|
49
|
-
# -> bun-cpp-objects.a
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Linking
|
|
53
|
-
|
|
54
|
-
The goal is you run both stages from above on different machines, so that they can build in parallel. Zig build is slow, and MacOS build runners are slower on average than the linux ones. With both artifacts from above, you can link them together:
|
|
55
|
-
|
|
56
|
-
```sh
|
|
57
|
-
cd tmp3
|
|
58
|
-
|
|
59
|
-
cmake $BUN_REPO \
|
|
60
|
-
-G Ninja \
|
|
61
|
-
-DCMAKE_BUILD_TYPE=Release \
|
|
62
|
-
-DBUN_LINK_ONLY=1 \
|
|
63
|
-
-DBUN_ZIG_OBJ_DIR="/path/to/bun-zig-dir" \
|
|
64
|
-
-DBUN_CPP_ARCHIVE="/path/to/bun-cpp-objects.a"
|
|
65
|
-
|
|
66
|
-
ninja
|
|
67
|
-
|
|
68
|
-
# optional:
|
|
69
|
-
# -DBUN_DEPS_OUT_DIR=... custom deps dir, use this to cache the built deps between rebuilds
|
|
70
|
-
# -DWEBKIT_DIR=... same thing, but it's probably fast enough to pull from github releases
|
|
71
|
-
|
|
72
|
-
# -> bun
|
|
73
|
-
# -> bun-profile
|
|
74
|
-
# -> bun.dSYM/
|
|
75
|
-
```
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
Bun itself is MIT-licensed.
|
|
2
|
-
|
|
3
|
-
## JavaScriptCore
|
|
4
|
-
|
|
5
|
-
Bun statically links JavaScriptCore (and WebKit) which is LGPL-2 licensed. WebCore files from WebKit are also licensed under LGPL2. Per LGPL2:
|
|
6
|
-
|
|
7
|
-
> (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.
|
|
8
|
-
|
|
9
|
-
You can find the patched version of WebKit used by Bun here: <https://github.com/oven-sh/webkit>. If you would like to relink Bun with changes:
|
|
10
|
-
|
|
11
|
-
- `git submodule update --init --recursive`
|
|
12
|
-
- `make jsc`
|
|
13
|
-
- `zig build`
|
|
14
|
-
|
|
15
|
-
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.
|
|
16
|
-
|
|
17
|
-
## Linked libraries
|
|
18
|
-
|
|
19
|
-
Bun statically links these libraries:
|
|
20
|
-
|
|
21
|
-
| Library | License |
|
|
22
|
-
|---------|---------|
|
|
23
|
-
| [`boringssl`](https://boringssl.googlesource.com/boringssl/) | [several licenses](https://boringssl.googlesource.com/boringssl/+/refs/heads/master/LICENSE) |
|
|
24
|
-
| [`brotli`](https://github.com/google/brotli) | MIT |
|
|
25
|
-
| [`libarchive`](https://github.com/libarchive/libarchive) | [several licenses](https://github.com/libarchive/libarchive/blob/master/COPYING) |
|
|
26
|
-
| [`lol-html`](https://github.com/cloudflare/lol-html/tree/master/c-api) | BSD 3-Clause |
|
|
27
|
-
| [`mimalloc`](https://github.com/microsoft/mimalloc) | MIT |
|
|
28
|
-
| [`picohttp`](https://github.com/h2o/picohttpparser) | dual-licensed under the Perl License or the MIT License |
|
|
29
|
-
| [`zstd`](https://github.com/facebook/zstd) | dual-licensed under the BSD License or GPLv2 license |
|
|
30
|
-
| [`simdutf`](https://github.com/simdutf/simdutf) | Apache 2.0 |
|
|
31
|
-
| [`tinycc`](https://github.com/tinycc/tinycc) | LGPL v2.1 |
|
|
32
|
-
| [`uSockets`](https://github.com/uNetworking/uSockets) | Apache 2.0 |
|
|
33
|
-
| [`zlib-cloudflare`](https://github.com/cloudflare/zlib) | zlib |
|
|
34
|
-
| [`c-ares`](https://github.com/c-ares/c-ares) | MIT licensed |
|
|
35
|
-
| [`libicu`](https://github.com/unicode-org/icu) 72 | [license here](https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE) |
|
|
36
|
-
| [`libbase64`](https://github.com/aklomp/base64/blob/master/LICENSE) | BSD 2-Clause |
|
|
37
|
-
| [`libuv`](https://github.com/libuv/libuv) (on Windows) | MIT |
|
|
38
|
-
| [`libdeflate`](https://github.com/ebiggers/libdeflate) | MIT |
|
|
39
|
-
| A fork of [`uWebsockets`](https://github.com/jarred-sumner/uwebsockets) | Apache 2.0 licensed |
|
|
40
|
-
| Parts of [Tigerbeetle's IO code](https://github.com/tigerbeetle/tigerbeetle/blob/532c8b70b9142c17e07737ab6d3da68d7500cbca/src/io/windows.zig#L1) | Apache 2.0 licensed |
|
|
41
|
-
|
|
42
|
-
## Polyfills
|
|
43
|
-
|
|
44
|
-
For compatibility reasons, the following packages are embedded into Bun's binary and injected if imported.
|
|
45
|
-
|
|
46
|
-
| Package | License |
|
|
47
|
-
|---------|---------|
|
|
48
|
-
| [`assert`](https://npmjs.com/package/assert) | MIT |
|
|
49
|
-
| [`browserify-zlib`](https://npmjs.com/package/browserify-zlib) | MIT |
|
|
50
|
-
| [`buffer`](https://npmjs.com/package/buffer) | MIT |
|
|
51
|
-
| [`constants-browserify`](https://npmjs.com/package/constants-browserify) | MIT |
|
|
52
|
-
| [`crypto-browserify`](https://npmjs.com/package/crypto-browserify) | MIT |
|
|
53
|
-
| [`domain-browser`](https://npmjs.com/package/domain-browser) | MIT |
|
|
54
|
-
| [`events`](https://npmjs.com/package/events) | MIT |
|
|
55
|
-
| [`https-browserify`](https://npmjs.com/package/https-browserify) | MIT |
|
|
56
|
-
| [`os-browserify`](https://npmjs.com/package/os-browserify) | MIT |
|
|
57
|
-
| [`path-browserify`](https://npmjs.com/package/path-browserify) | MIT |
|
|
58
|
-
| [`process`](https://npmjs.com/package/process) | MIT |
|
|
59
|
-
| [`punycode`](https://npmjs.com/package/punycode) | MIT |
|
|
60
|
-
| [`querystring-es3`](https://npmjs.com/package/querystring-es3) | MIT |
|
|
61
|
-
| [`stream-browserify`](https://npmjs.com/package/stream-browserify) | MIT |
|
|
62
|
-
| [`stream-http`](https://npmjs.com/package/stream-http) | MIT |
|
|
63
|
-
| [`string_decoder`](https://npmjs.com/package/string_decoder) | MIT |
|
|
64
|
-
| [`timers-browserify`](https://npmjs.com/package/timers-browserify) | MIT |
|
|
65
|
-
| [`tty-browserify`](https://npmjs.com/package/tty-browserify) | MIT |
|
|
66
|
-
| [`url`](https://npmjs.com/package/url) | MIT |
|
|
67
|
-
| [`util`](https://npmjs.com/package/util) | MIT |
|
|
68
|
-
| [`vm-browserify`](https://npmjs.com/package/vm-browserify) | MIT |
|
|
69
|
-
|
|
70
|
-
## Additional credits
|
|
71
|
-
|
|
72
|
-
- 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.
|
|
73
|
-
- Credit to [@kipply](https://github.com/kipply) for the name "Bun"!
|