Skip to content

Commit 7501636

Browse files
authored
Merge branch 'main' into feat/bun-write-append
2 parents 1c39917 + ff590e9 commit 7501636

File tree

84 files changed

+2855
-1162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2855
-1162
lines changed

bench/snippets/ipc-json-child.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Child process for IPC benchmarks - echoes messages back to parent
2+
process.on("message", message => {
3+
process.send(message);
4+
});

bench/snippets/ipc-json.mjs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { fork } from "node:child_process";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import { bench, run } from "../runner.mjs";
5+
6+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
7+
const childPath = path.join(__dirname, "ipc-json-child.mjs");
8+
9+
const smallMessage = { type: "ping", id: 1 };
10+
const largeString = Buffer.alloc(10 * 1024 * 1024, "A").toString();
11+
const largeMessage = { type: "ping", id: 1, data: largeString };
12+
13+
async function runBenchmark(message, count) {
14+
let received = 0;
15+
const { promise, resolve } = Promise.withResolvers();
16+
17+
const child = fork(childPath, [], {
18+
stdio: ["ignore", "ignore", "ignore", "ipc"],
19+
serialization: "json",
20+
});
21+
22+
child.on("message", () => {
23+
received++;
24+
if (received >= count) {
25+
resolve();
26+
}
27+
});
28+
29+
for (let i = 0; i < count; i++) {
30+
child.send(message);
31+
}
32+
33+
await promise;
34+
child.kill();
35+
}
36+
37+
bench("ipc json - small messages (1000 roundtrips)", async () => {
38+
await runBenchmark(smallMessage, 1000);
39+
});
40+
41+
bench("ipc json - 10MB messages (10 roundtrips)", async () => {
42+
await runBenchmark(largeMessage, 10);
43+
});
44+
45+
await run();

cmake/targets/BuildBun.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,9 @@ execute_process(
419419
--command=list-outputs
420420
--sources=${BUN_BINDGENV2_SOURCES_COMMA_SEPARATED}
421421
--codegen-path=${CODEGEN_PATH}
422-
RESULT_VARIABLE bindgen_result
423422
OUTPUT_VARIABLE bindgen_outputs
423+
COMMAND_ERROR_IS_FATAL ANY
424424
)
425-
if(${bindgen_result})
426-
message(FATAL_ERROR "bindgenv2/script.ts exited with non-zero status")
427-
endif()
428425
foreach(output IN LISTS bindgen_outputs)
429426
if(output MATCHES "\.cpp$")
430427
list(APPEND BUN_BINDGENV2_CPP_OUTPUTS ${output})

cmake/tools/SetupBuildkite.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ if(NOT BUILDKITE_BUILD_STATUS EQUAL 0)
4848
endif()
4949

5050
file(READ ${BUILDKITE_BUILD_PATH}/build.json BUILDKITE_BUILD)
51+
# Escape backslashes so CMake doesn't interpret JSON escape sequences (e.g., \n in commit messages)
52+
string(REPLACE "\\" "\\\\" BUILDKITE_BUILD "${BUILDKITE_BUILD}")
53+
5154
string(JSON BUILDKITE_BUILD_UUID GET ${BUILDKITE_BUILD} id)
5255
string(JSON BUILDKITE_JOBS GET ${BUILDKITE_BUILD} jobs)
5356
string(JSON BUILDKITE_JOBS_COUNT LENGTH ${BUILDKITE_JOBS})

cmake/tools/SetupWebKit.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if(WEBKIT_LOCAL)
2828
# make jsc-compile-debug jsc-copy-headers
2929
include_directories(
3030
${WEBKIT_PATH}
31+
${WEBKIT_PATH}/JavaScriptCore/Headers
3132
${WEBKIT_PATH}/JavaScriptCore/Headers/JavaScriptCore
3233
${WEBKIT_PATH}/JavaScriptCore/PrivateHeaders
3334
${WEBKIT_PATH}/bmalloc/Headers
@@ -90,7 +91,14 @@ if(EXISTS ${WEBKIT_PATH}/package.json)
9091
endif()
9192
endif()
9293

93-
file(DOWNLOAD ${WEBKIT_DOWNLOAD_URL} ${CACHE_PATH}/${WEBKIT_FILENAME} SHOW_PROGRESS)
94+
file(
95+
DOWNLOAD ${WEBKIT_DOWNLOAD_URL} ${CACHE_PATH}/${WEBKIT_FILENAME} SHOW_PROGRESS
96+
STATUS WEBKIT_DOWNLOAD_STATUS
97+
)
98+
if(NOT "${WEBKIT_DOWNLOAD_STATUS}" MATCHES "^0;")
99+
message(FATAL_ERROR "Failed to download WebKit: ${WEBKIT_DOWNLOAD_STATUS}")
100+
endif()
101+
94102
file(ARCHIVE_EXTRACT INPUT ${CACHE_PATH}/${WEBKIT_FILENAME} DESTINATION ${CACHE_PATH} TOUCH)
95103
file(REMOVE ${CACHE_PATH}/${WEBKIT_FILENAME})
96104
file(REMOVE_RECURSE ${WEBKIT_PATH})

docs/guides/ecosystem/pm2.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Alternatively, you can create a PM2 configuration file. Create a file named `pm2
3333

3434
```js pm2.config.js icon="file-code"
3535
module.exports = {
36-
title: "app", // Name of your application
36+
name: "app", // Name of your application
3737
script: "index.ts", // Entry point of your application
3838
interpreter: "bun", // Bun interpreter
3939
env: {

docs/pm/isolated-installs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Isolated installs are conceptually similar to pnpm, so migration should be strai
189189

190190
```bash terminal icon="terminal"
191191
# Remove pnpm files
192-
$ rm -rf node_modules pnpm-lock.yaml
192+
rm -rf node_modules pnpm-lock.yaml
193193

194194
# Install with Bun's isolated linker
195195
bun install --linker isolated

docs/pm/npmrc.mdx

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ The following options are supported:
7272
- `username`
7373
- `_password` (base64 encoded password)
7474
- `_auth` (base64 encoded username:password, e.g. `btoa(username + ":" + password)`)
75+
- `email`
7576

7677
The equivalent `bunfig.toml` option is to add a key in [`install.scopes`](/runtime/bunfig#install-registry):
7778

@@ -109,3 +110,136 @@ The equivalent `bunfig.toml` option is [`install.exact`](/runtime/bunfig#install
109110
[install]
110111
exact = true
111112
```
113+
114+
### `ignore-scripts`: Skip lifecycle scripts
115+
116+
Prevents running lifecycle scripts during installation:
117+
118+
```ini .npmrc icon="npm"
119+
ignore-scripts=true
120+
```
121+
122+
This is equivalent to using the `--ignore-scripts` flag with `bun install`.
123+
124+
### `dry-run`: Preview changes without installing
125+
126+
Shows what would be installed without actually installing:
127+
128+
```ini .npmrc icon="npm"
129+
dry-run=true
130+
```
131+
132+
The equivalent `bunfig.toml` option is [`install.dryRun`](/runtime/bunfig#install-dryrun):
133+
134+
```toml bunfig.toml icon="settings"
135+
[install]
136+
dryRun = true
137+
```
138+
139+
### `cache`: Configure cache directory
140+
141+
Set the cache directory path, or disable caching:
142+
143+
```ini .npmrc icon="npm"
144+
# set a custom cache directory
145+
cache=/path/to/cache
146+
147+
# or disable caching
148+
cache=false
149+
```
150+
151+
The equivalent `bunfig.toml` option is [`install.cache`](/runtime/bunfig#install-cache):
152+
153+
```toml bunfig.toml icon="settings"
154+
[install.cache]
155+
# set a custom cache directory
156+
dir = "/path/to/cache"
157+
158+
# or disable caching
159+
disable = true
160+
```
161+
162+
### `ca` and `cafile`: Configure CA certificates
163+
164+
Configure custom CA certificates for registry connections:
165+
166+
```ini .npmrc icon="npm"
167+
# single CA certificate
168+
ca="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
169+
170+
# multiple CA certificates
171+
ca[]="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
172+
ca[]="-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
173+
174+
# or specify a path to a CA file
175+
cafile=/path/to/ca-bundle.crt
176+
```
177+
178+
### `omit` and `include`: Control dependency types
179+
180+
Control which dependency types are installed:
181+
182+
```ini .npmrc icon="npm"
183+
# omit dev dependencies
184+
omit=dev
185+
186+
# omit multiple types
187+
omit[]=dev
188+
omit[]=optional
189+
190+
# include specific types (overrides omit)
191+
include=dev
192+
```
193+
194+
Valid values: `dev`, `peer`, `optional`
195+
196+
### `install-strategy` and `node-linker`: Installation strategy
197+
198+
Control how packages are installed in `node_modules`. Bun supports two different configuration options for compatibility with different package managers.
199+
200+
**npm's `install-strategy`:**
201+
202+
```ini .npmrc icon="npm"
203+
# flat node_modules structure (default)
204+
install-strategy=hoisted
205+
206+
# symlinked structure
207+
install-strategy=linked
208+
```
209+
210+
**pnpm/yarn's `node-linker`:**
211+
212+
The `node-linker` option controls the installation mode. Bun supports values from both pnpm and yarn:
213+
214+
| Value | Description | Accepted by |
215+
| -------------- | ----------------------------------------------- | ----------- |
216+
| `isolated` | Symlinked structure with isolated dependencies | pnpm |
217+
| `hoisted` | Flat node_modules structure | pnpm |
218+
| `pnpm` | Symlinked structure (same as `isolated`) | yarn |
219+
| `node-modules` | Flat node_modules structure (same as `hoisted`) | yarn |
220+
221+
```ini .npmrc icon="npm"
222+
# symlinked/isolated mode
223+
node-linker=isolated
224+
node-linker=pnpm
225+
226+
# flat/hoisted mode
227+
node-linker=hoisted
228+
node-linker=node-modules
229+
```
230+
231+
### `public-hoist-pattern` and `hoist-pattern`: Control hoisting
232+
233+
Control which packages are hoisted to the root `node_modules`:
234+
235+
```ini .npmrc icon="npm"
236+
# packages matching this pattern will be hoisted to the root
237+
public-hoist-pattern=*eslint*
238+
239+
# multiple patterns
240+
public-hoist-pattern[]=*eslint*
241+
public-hoist-pattern[]=*prettier*
242+
243+
# control general hoisting behavior
244+
hoist-pattern=*
245+
```

docs/project/building-windows.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ It is strongly recommended to use [PowerShell 7 (`pwsh.exe`)](https://learn.micr
1414
By default, running unverified scripts are blocked.
1515

1616
```ps1
17-
> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
17+
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
1818
```
1919

2020
### System Dependencies
2121

2222
Bun v1.1 or later. We use Bun to run it's own code generators.
2323

2424
```ps1
25-
> irm bun.sh/install.ps1 | iex
25+
irm bun.sh/install.ps1 | iex
2626
```
2727

2828
[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.
2929

3030
Visual Studio can be installed graphically using the wizard or through WinGet:
3131

3232
```ps1
33-
> winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Git " -s msstore
33+
winget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Git " -s msstore
3434
```
3535

3636
After Visual Studio, you need the following:
@@ -48,10 +48,10 @@ After Visual Studio, you need the following:
4848
[Scoop](https://scoop.sh) can be used to install these remaining tools easily.
4949

5050
```ps1 Scoop
51-
> irm https://get.scoop.sh | iex
52-
> scoop install nodejs-lts go rust nasm ruby perl ccache
51+
irm https://get.scoop.sh | iex
52+
scoop install nodejs-lts go rust nasm ruby perl ccache
5353
# scoop seems to be buggy if you install llvm and the rest at the same time
54-
> scoop install [email protected]
54+
scoop install [email protected]
5555
```
5656

5757
<Note>
@@ -63,19 +63,19 @@ After Visual Studio, you need the following:
6363
If you intend on building WebKit locally (optional), you should install these packages:
6464

6565
```ps1 Scoop
66-
> scoop install make cygwin python
66+
scoop install make cygwin python
6767
```
6868

6969
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:
7070

7171
```ps1
72-
> .\scripts\vs-shell.ps1
72+
.\scripts\vs-shell.ps1
7373
```
7474

7575
To verify, you can check for an MSVC-only command line such as `mt.exe`
7676

7777
```ps1
78-
> Get-Command mt
78+
Get-Command mt
7979
```
8080

8181
<Note>
@@ -86,16 +86,16 @@ To verify, you can check for an MSVC-only command line such as `mt.exe`
8686
## Building
8787

8888
```ps1
89-
> bun run build
89+
bun run build
9090
9191
# after the initial `bun run build` you can use the following to build
92-
> ninja -Cbuild/debug
92+
ninja -Cbuild/debug
9393
```
9494

9595
If this was successful, you should have a `bun-debug.exe` in the `build/debug` folder.
9696

9797
```ps1
98-
> .\build\debug\bun-debug.exe --revision
98+
.\build\debug\bun-debug.exe --revision
9999
```
100100

101101
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).
@@ -111,15 +111,15 @@ You can run the test suite either using `bun test <path>` or by using the wrappe
111111

112112
```ps1
113113
# Setup
114-
> bun i --cwd packages\bun-internal-test
114+
bun i --cwd packages\bun-internal-test
115115
116116
# Run the entire test suite with reporter
117117
# the package.json script "test" uses "build/debug/bun-debug.exe" by default
118-
> bun run test
118+
bun run test
119119
120120
# Run an individual test file:
121-
> bun-debug test node\fs
122-
> bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js"
121+
bun-debug test node\fs
122+
bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js"
123123
```
124124

125125
## Troubleshooting

0 commit comments

Comments
 (0)