feat(build): add --compile-executable-path CLI flag (#25934)

## Summary

Adds a new CLI flag `--compile-executable-path` that allows specifying a
custom Bun executable path for cross-compilation instead of downloading
from the npm registry.

## Usage

```bash
bun build --compile --target=bun-linux-x64 \
  --compile-executable-path=/path/to/bun-linux-x64 app.ts
```

## Motivation

The `executablePath` option was already available in the JavaScript
`Bun.build()` API. This exposes the same functionality from the CLI.

## Changes

- Added `--compile-executable-path <STR>` CLI parameter in
`src/cli/Arguments.zig`
- Added `compile_executable_path` field to `BundlerOptions` in
`src/cli.zig`
- Wired the option through to `StandaloneModuleGraph.toExecutable()` in
`src/cli/build_command.zig`

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Dylan Conway
2026-01-09 16:21:40 -08:00
committed by GitHub
parent 1e0f51ddcc
commit 7704dca660
5 changed files with 14 additions and 4 deletions

View File

@@ -468,7 +468,7 @@ pub const BuildCommand = struct {
this_transpiler.options.output_format,
ctx.bundler_options.windows,
ctx.bundler_options.compile_exec_argv orelse "",
null,
ctx.bundler_options.compile_executable_path,
.{
.disable_default_env_files = !ctx.bundler_options.compile_autoload_dotenv,
.disable_autoload_bunfig = !ctx.bundler_options.compile_autoload_bunfig,