Skip to content

Commit 23d88b5

Browse files
authored
Merge branch 'main' into claude/fix-resolves-rejects-return-promise
2 parents bbc3e79 + 9086b8f commit 23d88b5

File tree

91 files changed

+5106
-2286
lines changed

Some content is hidden

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

91 files changed

+5106
-2286
lines changed

.claude/hooks/pre-bash-zig-build.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,39 @@ if (argv0 === "timeout") {
9292

9393
// Check if it's "bun bd" or "bun-debug bd" without other positional args
9494
if (actualCommand === "bun" || actualCommand.includes("bun-debug")) {
95-
const positionalArgs = restArgs.filter(arg => !arg.startsWith("-"));
95+
// Claude is a sneaky fucker
96+
let positionalArgs = restArgs.filter(arg => !arg.startsWith("-"));
97+
const redirectStderrToStdoutIndex = positionalArgs.findIndex(arg => arg === "2>&1");
98+
if (redirectStderrToStdoutIndex !== -1) {
99+
positionalArgs.splice(redirectStderrToStdoutIndex, 1);
100+
}
101+
const redirectStdoutToStderrIndex = positionalArgs.findIndex(arg => arg === "1>&2");
102+
if (redirectStdoutToStderrIndex !== -1) {
103+
positionalArgs.splice(redirectStdoutToStderrIndex, 1);
104+
}
105+
106+
const redirectToFileIndex = positionalArgs.findIndex(arg => arg === ">");
107+
if (redirectToFileIndex !== -1) {
108+
positionalArgs.splice(redirectToFileIndex, 2);
109+
}
110+
111+
const redirectToFileAppendIndex = positionalArgs.findIndex(arg => arg === ">>");
112+
if (redirectToFileAppendIndex !== -1) {
113+
positionalArgs.splice(redirectToFileAppendIndex, 2);
114+
}
115+
116+
const redirectTOFileInlineIndex = positionalArgs.findIndex(arg => arg.startsWith(">"));
117+
if (redirectTOFileInlineIndex !== -1) {
118+
positionalArgs.splice(redirectTOFileInlineIndex, 1);
119+
}
120+
121+
const pipeIndex = positionalArgs.findIndex(arg => arg === "|");
122+
if (pipeIndex !== -1) {
123+
positionalArgs = positionalArgs.slice(0, pipeIndex);
124+
}
125+
126+
positionalArgs = positionalArgs.map(arg => arg.trim()).filter(Boolean);
127+
96128
if (positionalArgs.length === 1 && positionalArgs[0] === "bd") {
97129
denyWithReason("error: Run `bun bd` without a timeout");
98130
}

.github/workflows/claude.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ jobs:
5757
git reset --hard origin/${{ github.event.pull_request.head.ref }}
5858
- name: Run Claude Code
5959
id: claude
60-
# TODO: switch this out once they merge their v1
61-
uses: km-anthropic/claude-code-action@v1-dev
60+
uses: anthropics/claude-code-action@v1
6261
with:
6362
timeout_minutes: "180"
6463
claude_args: |

.github/workflows/labeled.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ jobs:
142142
uses: actions/github-script@v7
143143
with:
144144
script: |
145-
const closeAction = JSON.parse('${{ steps.add-labels.outputs.close-action }}');
146-
145+
const closeAction = ${{ fromJson(steps.add-labels.outputs.close-action) }};
146+
147147
// Comment with the reason
148148
await github.rest.issues.createComment({
149149
owner: context.repo.owner,
150150
repo: context.repo.repo,
151151
issue_number: context.issue.number,
152152
body: closeAction.comment
153153
});
154-
154+
155155
// Close the issue
156156
await github.rest.issues.update({
157157
owner: context.repo.owner,

LATEST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.23
1+
1.3.0

cmake/targets/BuildBun.cmake

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,6 @@ if(APPLE)
10451045
-Wl,-no_compact_unwind
10461046
-Wl,-stack_size,0x1200000
10471047
-fno-keep-static-consts
1048-
-Wl,-map,${bun}.linker-map
10491048
)
10501049

10511050
if(DEBUG)
@@ -1065,6 +1064,7 @@ if(APPLE)
10651064
target_link_options(${bun} PUBLIC
10661065
-dead_strip
10671066
-dead_strip_dylibs
1067+
-Wl,-map,${bun}.linker-map
10681068
)
10691069
endif()
10701070
endif()
@@ -1098,6 +1098,17 @@ if(LINUX)
10981098
)
10991099
endif()
11001100

1101+
if (ENABLE_LTO)
1102+
# We are optimizing for size at a slight debug-ability cost
1103+
target_link_options(${bun} PUBLIC
1104+
-Wl,--no-eh-frame-hdr
1105+
)
1106+
else()
1107+
target_link_options(${bun} PUBLIC
1108+
-Wl,--eh-frame-hdr
1109+
)
1110+
endif()
1111+
11011112
target_link_options(${bun} PUBLIC
11021113
--ld-path=${LLD_PROGRAM}
11031114
-fno-pic
@@ -1112,11 +1123,9 @@ if(LINUX)
11121123
# make debug info faster to load
11131124
-Wl,--gdb-index
11141125
-Wl,-z,combreloc
1115-
-Wl,--no-eh-frame-hdr
11161126
-Wl,--sort-section=name
11171127
-Wl,--hash-style=both
11181128
-Wl,--build-id=sha1 # Better for debugging than default
1119-
-Wl,-Map=${bun}.linker-map
11201129
)
11211130

11221131
# don't strip in debug, this seems to be needed so that the Zig std library
@@ -1131,6 +1140,7 @@ if(LINUX)
11311140
if (NOT DEBUG AND NOT ENABLE_ASAN AND NOT ENABLE_VALGRIND)
11321141
target_link_options(${bun} PUBLIC
11331142
-Wl,-icf=safe
1143+
-Wl,-Map=${bun}.linker-map
11341144
)
11351145
endif()
11361146

@@ -1452,7 +1462,7 @@ if(NOT BUN_CPP_ONLY)
14521462
list(APPEND bunFiles ${bun}.dSYM)
14531463
endif()
14541464

1455-
if(APPLE OR LINUX)
1465+
if((APPLE OR LINUX) AND NOT ENABLE_ASAN)
14561466
list(APPEND bunFiles ${bun}.linker-map)
14571467
endif()
14581468

cmake/targets/BuildLibuv.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ register_repository(
44
REPOSITORY
55
libuv/libuv
66
COMMIT
7-
# Corresponds to v1.51.0
8-
5152db2cbfeb5582e9c27c5ea1dba2cd9e10759b
7+
# Latest HEAD (includes recursion bug fix #4784)
8+
f3ce527ea940d926c40878ba5de219640c362811
99
)
1010

1111
if(WIN32)

docs/cli/init.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,29 @@ Scaffold an empty Bun project with the interactive `bun init` command.
22

33
```bash
44
$ bun init
5-
bun init helps you get started with a minimal project and tries to
6-
guess sensible defaults. Press ^C anytime to quit.
75

8-
package name (quickstart):
9-
entry point (index.ts):
6+
? Select a project template - Press return to submit.
7+
❯ Blank
8+
React
9+
Library
1010

11-
Done! A package.json file was saved in the current directory.
12-
+ index.ts
13-
+ .gitignore
14-
+ tsconfig.json (for editor auto-complete)
15-
+ README.md
11+
✓ Select a project template: Blank
12+
13+
+ .gitignore
14+
+ index.ts
15+
+ tsconfig.json (for editor autocomplete)
16+
+ README.md
1617

1718
To get started, run:
18-
bun run index.ts
19+
20+
bun run index.ts
21+
22+
bun install v$BUN_LATEST_VERSION
23+
24+
+ @types/bun@$BUN_LATEST_VERSION
25+
26+
27+
7 packages installed
1928
```
2029

2130
Press `enter` to accept the default answer for each prompt, or pass the `-y` flag to auto-accept the defaults.

docs/quickstart.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,29 @@ Run `bun init` to scaffold a new project. It's an interactive tool; for this tut
99

1010
```bash
1111
$ bun init
12-
bun init helps you get started with a minimal project and tries to
13-
guess sensible defaults. Press ^C anytime to quit.
1412

15-
package name (quickstart):
16-
entry point (index.ts):
13+
? Select a project template - Press return to submit.
14+
❯ Blank
15+
React
16+
Library
1717

18-
Done! A package.json file was saved in the current directory.
19-
+ index.ts
20-
+ .gitignore
21-
+ tsconfig.json (for editor auto-complete)
22-
+ README.md
18+
✓ Select a project template: Blank
19+
20+
+ .gitignore
21+
+ index.ts
22+
+ tsconfig.json (for editor autocomplete)
23+
+ README.md
2324

2425
To get started, run:
25-
bun run index.ts
26+
27+
bun run index.ts
28+
29+
bun install v$BUN_LATEST_VERSION
30+
31+
+ @types/bun@$BUN_LATEST_VERSION
32+
33+
34+
7 packages installed
2635
```
2736

2837
Since our entry point is a `*.ts` file, Bun generates a `tsconfig.json` for you. If you're using plain JavaScript, it will generate a [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) instead.
@@ -88,11 +97,15 @@ Bun can also execute `"scripts"` from your `package.json`. Add the following scr
8897
"name": "quickstart",
8998
"module": "index.ts",
9099
"type": "module",
100+
"private": true,
91101
+ "scripts": {
92102
+ "start": "bun run index.ts"
93103
+ },
94104
"devDependencies": {
95105
"@types/bun": "latest"
106+
},
107+
"peerDependencies": {
108+
"typescript": "^5"
96109
}
97110
}
98111
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "bun",
4-
"version": "1.3.0",
4+
"version": "1.3.1",
55
"workspaces": [
66
"./packages/bun-types",
77
"./packages/@types/bun"

packages/bun-usockets/src/bsd.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,12 +1467,39 @@ static int is_loopback(struct sockaddr_storage *sockaddr) {
14671467
}
14681468
#endif
14691469

1470-
LIBUS_SOCKET_DESCRIPTOR bsd_create_connect_socket(struct sockaddr_storage *addr, int options) {
1470+
LIBUS_SOCKET_DESCRIPTOR bsd_create_connect_socket(struct sockaddr_storage *addr, int options, struct sockaddr_storage *local_addr) {
14711471
LIBUS_SOCKET_DESCRIPTOR fd = bsd_create_socket(addr->ss_family, SOCK_STREAM, 0, NULL);
14721472
if (fd == LIBUS_SOCKET_ERROR) {
14731473
return LIBUS_SOCKET_ERROR;
14741474
}
14751475

1476+
// Bind to local address if specified
1477+
if (local_addr != NULL) {
1478+
socklen_t addr_len;
1479+
if (local_addr->ss_family == AF_INET) {
1480+
addr_len = sizeof(struct sockaddr_in);
1481+
} else if (local_addr->ss_family == AF_INET6) {
1482+
addr_len = sizeof(struct sockaddr_in6);
1483+
} else {
1484+
bsd_close_socket(fd);
1485+
#ifdef _WIN32
1486+
WSASetLastError(WSAEAFNOSUPPORT);
1487+
#endif
1488+
errno = EAFNOSUPPORT;
1489+
return LIBUS_SOCKET_ERROR;
1490+
}
1491+
1492+
int bind_result;
1493+
do {
1494+
bind_result = bind(fd, (struct sockaddr *)local_addr, addr_len);
1495+
} while (IS_EINTR(bind_result));
1496+
1497+
if (bind_result != 0) {
1498+
bsd_close_socket(fd);
1499+
return LIBUS_SOCKET_ERROR;
1500+
}
1501+
}
1502+
14761503
#ifdef _WIN32
14771504
win32_set_nonblocking(fd);
14781505

0 commit comments

Comments
 (0)