mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary
- Adds support for setting Windows executable metadata through CLI flags
when using `bun build --compile`
- Implements efficient single-operation metadata updates using the
rescle library
- Provides comprehensive error handling and validation
## New CLI Flags
- `--windows-title`: Set the application title
- `--windows-publisher`: Set the publisher/company name
- `--windows-version`: Set the file version (e.g. "1.0.0.0")
- `--windows-description`: Set the file description
- `--windows-copyright`: Set the copyright notice
## JavaScript API
These options are also available through the `Bun.build()` JavaScript
API:
```javascript
await Bun.build({
entrypoints: ["./app.js"],
outfile: "./app.exe",
compile: true,
windows: {
title: "My Application",
publisher: "My Company",
version: "1.0.0.0",
description: "Application description",
copyright: "© 2025 My Company"
}
});
```
## Implementation Details
- Uses a unified `rescle__setWindowsMetadata` C++ function that loads
the Windows executable only once for efficiency
- Properly handles UTF-16 string conversion for Windows APIs
- Validates version format (supports "1", "1.2", "1.2.3", or "1.2.3.4"
formats)
- Returns specific error codes for better debugging
- All operations return errors instead of calling `Global.exit(1)`
## Test Plan
Comprehensive test suite added in
`test/bundler/compile-windows-metadata.test.ts` covering:
- All CLI flags individually and in combination
- JavaScript API usage
- Error cases (invalid versions, missing --compile flag, etc.)
- Special character handling in metadata strings
All 20 tests passing (1 skipped as not applicable on Windows).
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Zack Radisic <zack@theradisic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>