fix: Add CLI flag reference to JSDoc, improve initComptime warning

- Add "Equivalent to the CLI --feature flag" to bun.d.ts JSDoc
- Improve initComptime doc comment warning about undefined behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-12-11 02:45:06 +00:00
parent fd3daa2661
commit ca1bf28023
2 changed files with 4 additions and 2 deletions

View File

@@ -1897,6 +1897,8 @@ declare module "bun" {
* When `feature("FLAG_NAME")` is called, it returns `true` if FLAG_NAME is in this array,
* or `false` otherwise. This enables static dead-code elimination at bundle time.
*
* Equivalent to the CLI `--feature` flag.
*
* @example
* ```ts
* await Bun.build({

View File

@@ -1623,8 +1623,8 @@ pub const StringSet = struct {
}
/// Initialize an empty StringSet at comptime (for use as a static constant).
/// WARNING: The resulting set has an undefined allocator and must not be mutated.
/// Do not call insert(), clone(), or any method that allocates on a comptime-initialized set.
/// WARNING: The resulting set must not be mutated. Any attempt to call insert(),
/// clone(), or other allocating methods will result in undefined behavior.
pub fn initComptime() StringSet {
return StringSet{
.map = Map.initContext(undefined, .{}),