Ciro Spaciari
2d954995cd
Fix Response wrapper and us_internal_disable_sweep_timer ( #24623 )
...
### What does this PR do?
Fix Response wrapper and us_internal_disable_sweep_timer
Fixes
https://linear.app/oven/issue/ENG-21510/panic-attempt-to-use-null-value-in-responsezig
### How did you verify your code works?
CI
2025-11-18 14:00:53 -08:00
Meghan Denny
11b20aa508
runtime: fix small leak in Bun.listen ( #24799 )
...
pulled out of https://github.com/oven-sh/bun/pull/21663
Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com >
2025-11-18 12:00:56 -08:00
Meghan Denny
cac8e62635
zig: switch exhaustively on os + arch more ( #24796 )
2025-11-18 10:49:21 -08:00
Meghan Denny
f03957474e
runtime: fix small leak in Bun.spawn ( #24798 )
...
pulled out of https://github.com/oven-sh/bun/pull/21663
2025-11-18 09:57:19 -05:00
Meghan Denny
ab80bbe4c2
runtime: fix small leak in node:net.SocketAddress ( #24800 )
...
pulled out of https://github.com/oven-sh/bun/pull/21663
2025-11-18 09:55:45 -05:00
Meghan Denny
af498a0483
runtime: fix small leak in Blob deinit ( #24802 )
...
pulled out of https://github.com/oven-sh/bun/pull/21663
2025-11-18 09:55:15 -05:00
robobun
7c485177ee
Add compile-time flags to control .env and bunfig.toml autoloading ( #24790 )
...
## Summary
This PR adds two new compile options to control whether standalone
executables autoload `.env` files and `bunfig.toml` configuration files.
## New Options
### JavaScript API
```js
await Bun.build({
entrypoints: ["./entry.ts"],
compile: {
autoloadDotenv: false, // Disable .env loading (default: true)
autoloadBunfig: false, // Disable bunfig.toml loading (default: true)
}
});
```
### CLI Flags
```bash
bun build --compile --no-compile-autoload-dotenv entry.ts
bun build --compile --no-compile-autoload-bunfig entry.ts
bun build --compile --compile-autoload-dotenv entry.ts
bun build --compile --compile-autoload-bunfig entry.ts
```
## Implementation
The flags are stored in a new `Flags` packed struct in
`StandaloneModuleGraph`:
```zig
pub const Flags = packed struct(u32) {
disable_default_env_files: bool = false,
disable_autoload_bunfig: bool = false,
_padding: u30 = 0,
};
```
These flags are:
1. Set during compilation from CLI args or JS API options
2. Serialized into the `StandaloneModuleGraph` embedded in the
executable
3. Read at runtime in `bootStandalone()` to conditionally load config
files
## Testing
Manually tested and verified:
- ✅ Default behavior loads `.env` files
- ✅ `--no-compile-autoload-dotenv` disables `.env` loading
- ✅ `--compile-autoload-dotenv` explicitly enables `.env` loading
- ✅ Default behavior loads `bunfig.toml` (verified with preload script)
- ✅ `--no-compile-autoload-bunfig` disables `bunfig.toml` loading
Test cases added in `test/bundler/bundler_compile_autoload.test.ts`
## Files Changed
- `src/StandaloneModuleGraph.zig` - Added Flags struct, updated
encode/decode
- `src/bun.js.zig` - Checks flags in bootStandalone()
- `src/bun.js/api/JSBundler.zig` - Added autoload options to
CompileOptions
- `src/bundler/bundle_v2.zig` - Pass flags to toExecutable()
- `src/cli.zig` - Added flags to BundlerOptions
- `src/cli/Arguments.zig` - Added CLI argument parsing
- `src/cli/build_command.zig` - Pass flags from context
- `test/bundler/expectBundled.ts` - Support new compile options
- `test/bundler/bundler_compile_autoload.test.ts` - New test file
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com >
2025-11-18 09:46:44 -05:00
Marko Vejnovic
9513c1d1d9
chore: HttpContext.h cleanup ( #24730 )
2025-11-17 13:36:03 -08:00
robobun
509a97a435
Add --no-env-file flag to disable automatic .env loading ( #24767 )
...
## Summary
Implements `--no-env-file` CLI flag and bunfig configuration options to
disable automatic `.env` file loading at runtime and in the bundler.
## Motivation
Users may want to disable automatic `.env` file loading for:
- Production environments where env vars are managed externally
- CI/CD pipelines where .env files should be ignored
- Testing scenarios where explicit env control is needed
- Security contexts where .env files should not be trusted
## Changes
### CLI Flag
- Added `--no-env-file` flag that disables loading of default .env files
- Still respects explicit `--env-file` arguments for intentional env
loading
### Bunfig Configuration
Added support for disabling .env loading via `bunfig.toml`:
- `env = false` - disables default .env file loading
- `env = null` - disables default .env file loading
- `env.file = false` - disables default .env file loading
- `env.file = null` - disables default .env file loading
### Implementation
- Added `disable_default_env_files` field to `api.TransformOptions` with
serialization support
- Added `disable_default_env_files` field to `options.Env` struct
- Implemented `loadEnvConfig` in bunfig parser to handle env
configuration
- Wired up flag throughout runtime and bundler code paths
- Preserved package.json script runner behavior (always skips default
.env files)
## Tests
Added comprehensive test suite (`test/cli/run/no-envfile.test.ts`) with
9 tests covering:
- `--no-env-file` flag with `.env`, `.env.local`,
`.env.development.local`
- Bunfig configurations: `env = false`, `env.file = false`, `env = true`
- `--no-env-file` with `-e` eval flag
- `--no-env-file` combined with `--env-file` (explicit files still load)
- Production mode behavior
All tests pass with debug bun and fail with system bun (as expected).
## Example Usage
```bash
# Disable all default .env files
bun --no-env-file index.js
# Disable defaults but load explicit file
bun --no-env-file --env-file .env.production index.js
# Disable via bunfig.toml
cat > bunfig.toml << 'CONFIG'
env = false
CONFIG
bun index.js
```
## Files Changed
- `src/cli/Arguments.zig` - CLI flag parsing
- `src/api/schema.zig` - API schema field with encode/decode
- `src/options.zig` - Env struct field and wiring
- `src/bunfig.zig` - Config parsing with loadEnvConfig
- `src/transpiler.zig` - Runtime wiring
- `src/bun.js.zig` - Runtime wiring
- `src/cli/exec_command.zig` - Runtime wiring
- `src/cli/run_command.zig` - Preserved package.json script runner
behavior
- `test/cli/run/no-envfile.test.ts` - Comprehensive test suite
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
2025-11-17 15:04:42 -05:00
Dylan Conway
983bb52df7
fix #24550 ( #24726 )
...
### What does this PR do?
Fixes a regression introduced in Bun v1.3.2 with #24283 .
We are not able to skip `sharp` lifecycle scripts before v0.33.0 because
previous versions did not use optional dependencies with prebuilds.
Fixes #24550
Fixes ENG-21519
### How did you verify your code works?
Manually
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-17 15:04:20 -05:00
Meghan Denny
8b5b36ec7a
runtime: fix n-api ThreadSafeFunction finalizer ( #24771 )
...
Closes https://github.com/oven-sh/bun/issues/24552
Closes https://github.com/oven-sh/bun/issues/24664
Closes https://github.com/oven-sh/bun/issues/24702
Closes https://github.com/oven-sh/bun/issues/24703
Closes https://github.com/oven-sh/bun/issues/24768
2025-11-17 11:23:13 -08:00
Michael H
87eca6bbc7
docs: re-apply many recent changes that somehow aren't present ( #24719 )
...
lots of recent changes aren't present, so this reapplies them
2025-11-16 19:23:01 +11:00
Meghan Denny
2cb8d4eae8
cmake: remove GIT_CHANGED_SOURCES ( #24737 )
...
dead code
2025-11-15 16:45:37 -08:00
Meghan Denny
e53ceb62ec
zig: fix missing uses of bun.callmod_inline ( #24738 )
...
results in better strack traces in debug mode
2025-11-15 16:36:15 -08:00
pfg
277fc558e2
only-failures fix ( #24701 )
...
### What does this PR do?
Removes these accidental blank lines
<img width="170" height="139" alt="image"
src="https://github.com/user-attachments/assets/b44d6496-a497-4be6-9666-8134a70d7324 "
/>
### How did you verify your code works?
2025-11-14 19:52:43 -08:00
Dylan Conway
5908bfbfc6
fix(YAML.stringify): number-like strings prefixed with 0 ( #24731 )
...
### What does this PR do?
Ensures strings that would parse as a number with leading zeroes aren't
emitted without quotes.
fixes #23691
### How did you verify your code works?
Added a test
2025-11-14 17:43:36 -08:00
Dylan Conway
19f21c00bd
fix #24510 ( #24563 )
...
### What does this PR do?
The assertion was too strict.
This pr changes to assertion to allow multiple of the same dependency id
to be present. Also changes all the assertions to debug assertions.
fixes #24510
### How did you verify your code works?
Manually, and added a new test
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Marko Vejnovic <marko@bun.com >
2025-11-14 16:49:21 -08:00
Lydia Hallie
8650e7ace4
Docs: Add templates to guides ( #24732 )
...
Adds template cards to the TanStack Start and Next.js guides
2025-11-14 16:45:21 -08:00
robobun
b2c219a56c
Implement retry and repeats options for bun:test ( #23713 )
...
Fixes #16051 , Fixes ENG-21437
Implements retry/repeats
```ts
test("my test", () => {
if (Math.random() < 0.1) throw new Error("uh oh!");
}, {repeats: 20});
```
```
Error: uh oh!
✗ my test
```
```ts
test("my test", () => {
if (Math.random() < 0.1) throw new Error("uh oh!");
}, {retry: 5});
```
```
Error: uh oh!
✓ my test (attempt 2)
```
Also fixes a bug where onTestFinished inside a test would not run if the
test failed
```ts
test("abc", () => {
onTestFinished(() => { console.log("hello" });
throw new Error("uh oh!");
});
```
```
Error: uh oh!
hello
```
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: pfg <pfg@pfg.pw >
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-14 16:21:04 -08:00
Luke Parker
f216673f98
fix: Add missing SIGWINCH for windows ( #24704 )
...
### What does this PR do?
Fixes https://github.com/oven-sh/bun/issues/22288
Fixes #22402
Fixes https://github.com/oven-sh/bun/issues/23224
Fixes https://github.com/oven-sh/bun/issues/17803
cc: Should unblock opencode/opentui window resize on windows
https://github.com/sst/opentui/issues/152
### How did you verify your code works?
Clone the linked repro, verified latest bun failed, node worked, then
iterated till my local bun worked.
Here is a screenshot of the branch working with bun on windows
<img width="1427" height="891" alt="image"
src="https://github.com/user-attachments/assets/18642db7-4cb6-4758-bb76-a38d277cbc23 "
/>
Additionally using bun vs bun-debug on a little test for our downstream
package proves this works
<img width="1137" height="679" alt="image"
src="https://github.com/user-attachments/assets/4dbe7605-ced9-4bcb-84f0-ed793f8aa942 "
/>
<img width="1138" height="684" alt="image"
src="https://github.com/user-attachments/assets/f658b3b9-e4bc-4bfa-84f0-e1eb3af83d89 "
/>
2025-11-14 14:05:47 -08:00
Lydia Hallie
a70f2b7ff9
Docs: Add custor server instructions to TanStack guide ( #24723 )
...
Add docs on how to deploy a custom Bun server for TanStack Start. Based
on [this
example](https://github.com/TanStack/router/tree/main/examples/react/start-bun/server.ts )
2025-11-14 11:53:23 -08:00
Braden Wong
65a215bb4e
docs(watch): use relativePath parameter name in recursive example ( #24716 )
...
This updates the documentation for `fs.watch()` to use `relativePath`
instead of `filename` in the recursive example, following the same
convention from PR #23990 .
When `recursive: true` is set on `fs.watch()`, the callback receives a
relative path to the changed file rather than just a simple filename.
Using `relativePath` as the parameter name makes this distinction
clearer to users.
**Related to:** https://github.com/oven-sh/bun/pull/23990
Co-authored-by: Michael H <git@riskymh.dev >
2025-11-15 01:10:35 +11:00
Michael H
c3c91442ac
docs: fix custom loader example to be correct & other file-type doc updates ( #24677 )
2025-11-14 16:32:00 +11:00
Nino
93ab167a8d
docs: fix environment variable syntax in executable example ( #24706 )
...
### What does this PR do?
Fixes a typo in the docs.
`bun_BE_BUN=1` doesn't work, it has to be capitalized `BUN_BE_BUN=1`
2025-11-13 21:31:07 -08:00
pfg
d8ee26509c
Fix progress showing kb for downloading packages instead of count ( #24700 )
...
- show bytes for upgrading bun
- show no unit for other progress bars
Fix for issue introduced in #24266
2025-11-13 19:29:16 -08:00
Ciro Spaciari
21d582a3cd
fix(createEmptyObject) fix some createEmptyObject values ( #22512 )
...
### What does this PR do?
We must use the right number of properties (not more or less) or we
should set it to 0
### How did you verify your code works?
Read the code, this will avoid potencial crashs and improve stability
2025-11-13 15:19:18 -08:00
Meghan Denny
d7bf4fb443
ci/format: update bun version ( #24693 )
2025-11-13 15:00:40 -08:00
Ciro Spaciari
263d1ab178
update(crypto) update root certificates to NSS 3.117 ( #24607 )
...
### What does this PR do?
This is the certdata.txt[0] from NSS 3.117, released on 2025-11-11.
This is the version of NSS that will ship in Firefox 145.0 on
2025-11-11.
Certificates added:
- OISTE Server Root ECC G1
- OISTE Server Root RSA G1
[0]
https://hg.mozilla.org/projects/nss/raw-file/NSS_3_117_RTM/lib/ckfw/builtins/certdata.txt
765c9e86-0a91-4dad-b410-801cd60f8b32
Fixes https://linear.app/oven/issue/ENG-21508/update-root-certs
### How did you verify your code works?
CI
2025-11-13 13:26:34 -08:00
Marko Vejnovic
08843030f5
[publish images]
2025-11-13 12:04:47 -08:00
Kristjan Broder Lund
9ccc8fb795
docs: format code blocks correctly ( #24672 )
...
### What does this PR do?
The code blocks were not properly formatted, and did not render
correctly
`main`:
<img width="699" height="196" alt="image"
src="https://github.com/user-attachments/assets/c08bc29e-9481-47ae-bafe-dd94b22d0c09 "
/>
this pr:
<img width="691" height="306" alt="image"
src="https://github.com/user-attachments/assets/947fb9d7-04f3-42e8-aafe-0d70127fefd1 "
/>
### How did you verify your code works?
ran docs locally with mint
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Michael H <git@riskymh.dev >
2025-11-13 20:36:45 +11:00
S.T.P
4c03d3b8b6
docs: remove the redundant tags ( #24668 )
...
### What does this PR do?
Remove the redundant code block tag
<img width="1469" height="918" alt="image"
src="https://github.com/user-attachments/assets/3eb3b499-3165-409c-9360-2fe1872162ed "
/>
After change
<img width="1458" height="1006" alt="image"
src="https://github.com/user-attachments/assets/69eac47c-28cd-4459-9478-0098b51f78fe "
/>
### How did you verify your code works?
Preview the documentation locally
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Michael H <git@riskymh.dev >
2025-11-13 18:37:22 +11:00
Marko Vejnovic
6d2ce3892b
build(ENG-21514): Fix sccache invocation ( #24651 )
...
### What does this PR do?
Fixes some miswritten `cmake` steps so that `sccache` actually works
### How did you verify your code works?
2025-11-12 14:51:08 -08:00
Marko Vejnovic
e03d3bee10
ci(ENG-21502): Fix sccache not working inside Docker ( #24597 )
2025-11-12 14:40:12 -08:00
Caio Borghi
fff47f0267
docs: update EdgeDB references to Gel rebrand ( #24487 )
...
## Summary
EdgeDB has rebranded to Gel. This PR comprehensively updates all
documentation to reflect the rebrand.
## Changes Made
### Documentation & Branding
- **Guide title**: "Use EdgeDB with Bun" → "Use Gel with Bun"
- **File renamed**: `docs/guides/ecosystem/edgedb.mdx` → `gel.mdx`
- **Description**: Added "(formerly EdgeDB)" note
- **All path references**: Updated from `/guides/ecosystem/edgedb` to
`/guides/ecosystem/gel`
### CLI Commands
- `edgedb project init` → `gel project init`
- `edgedb` → `gel` (REPL)
- `edgedb migration create` → `gel migration create`
- `edgedb migrate` → `gel migrate`
### npm Packages
- `edgedb` → `gel`
- `@edgedb/generate` → `@gel/generate`
### Installation & Documentation URLs
- Installation link: `docs.geldata.com/learn/installation` (functional)
- Documentation reference: `docs.geldata.com/` (operational)
- Installation scripts: Verified working (`https://www.geldata.com/sh `
and `ps1`)
- Added Homebrew option: `brew install geldata/tap/gel-cli`
### Code Examples
- Updated all imports: `import { createClient } from "gel"`
- Updated codegen commands: `bunx @gel/generate`
## Verified
All commands verified against official Gel documentation at
https://docs.geldata.com/
Fixes #17721
---------
Co-authored-by: Lydia Hallie <lydiajuliettehallie@gmail.com >
2025-11-12 14:18:59 -08:00
Ciro Spaciari
4e1d9a2cbc
remove dead code in src/bake/DevServer/SerializedFailure.zig ( #24635 )
...
### What does this PR do?
remove dead code in src/bake/DevServer/SerializedFailure.zig
### How did you verify your code works?
It builds
2025-11-12 13:39:36 -08:00
Ciro Spaciari
1f0c885e91
proper handle on_data if we receive null ( #24624 )
...
### What does this PR do?
If for some reason data is null we should handle as empty
Fixes
https://linear.app/oven/issue/ENG-21511/panic-attempt-to-use-null-value-in-socket-on-data
### How did you verify your code works?
Ci
2025-11-12 12:42:06 -08:00
Ciro Spaciari
ab32a2fc4a
fix(bun getcompletes) add windows support and remove TODO panic ( #24620 )
...
### What does this PR do?
Fixes https://linear.app/oven/issue/ENG-21509/panic-todo-in-completions
### How did you verify your code works?
Test
2025-11-12 12:41:47 -08:00
Ciro Spaciari
8912957aa5
compatibility(node:net) _handle.fd property ( #24575 )
...
### What does this PR do?
Expose fd property in _handle for node:net/node:tls
Fixes
https://linear.app/oven/issue/ENG-21507/expose-fd-in-nodenetnodetls
### How did you verify your code works?
Test
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh >
Co-authored-by: Claude <noreply@anthropic.com >
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-11-12 12:28:55 -08:00
Ciro Spaciari
df4e42bf1c
fix(DevServer) remove panic in case of source type none ( #24634 )
...
### What does this PR do?
Remove panic in case of source type none, so we can handle it more
gracefully, we can discuss if this is the best solution but looks
sensible for me. This is really hard to repro but can happen when
deleting files referred by dynamic imports.
Fixes
https://linear.app/oven/issue/ENG-21513/panic-missing-internal-precomputed-line-count-in-renderjson-on
Fixes https://github.com/oven-sh/bun/issues/21714
### How did you verify your code works?
CI
---------
Co-authored-by: taylor.fish <contact@taylor.fish >
2025-11-12 12:28:17 -08:00
Ciro Spaciari
f67bec90c5
refactor(us_socket_t.zig) safer use of intCast ( #24622 )
...
### What does this PR do?
make sure to always safe intCast in us_socket_t
### How did you verify your code works?
Compiles
2025-11-12 11:02:39 -08:00
Michael H
fa099336da
docs: node does support "import path re-mapping" ( #17133 )
...
fixes #4545
2025-11-13 06:02:12 +11:00
Michael H
7f8dff64c4
docs: revert minifier doc's format ( #24639 )
2025-11-12 11:01:25 -08:00
Michael H
98a01e5d2a
docs: fix some pages ( #24632 )
2025-11-13 06:00:05 +11:00
Michael H
d1fa27acce
docs: document more loaders ( #24616 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-12 10:48:03 -08:00
Michael H
cf6662d48f
types: document configVersion in BunLockFile ( #24641 )
2025-11-12 10:47:30 -08:00
Marko Vejnovic
2563a9b3ad
build(ENG-21491): Improve sccache behavior on developer machines ( #24568 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-12 09:11:33 -08:00
Meghan Denny
e0aae8adc1
ci: remove unified-builds and unified-tests options ( #24626 )
2025-11-11 22:52:46 -08:00
Marko Vejnovic
6b8a75f6ab
chore(ENG-21504): Remove bit-rotted scripts ( #24606 )
...
### What does this PR do?
Removes some scripts which haven't been tested in a while.
### How did you verify your code works?
CI passes
2025-11-11 22:39:20 -08:00
pfg
97c113d010
remove unused writer type parameters in src/css/ ( #24571 )
...
No longer needed after zig upgrade
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-11 21:09:50 -08:00
Meghan Denny
7f4e65464e
zig: fix spurious dependency loop compile error in ResumableSink ( #24618 )
2025-11-11 20:22:24 -08:00