# rules_bun rule reference This file documents the public rules exported from `@rules_bun//bun:defs.bzl`. ## bun_binary Runs a JS/TS entry point with Bun as an executable target (`bazel run`). Attributes: - `entry_point` (label, required): path to the main JS/TS file to execute. - `node_modules` (label, optional): Bun/npm package files in runfiles. - `data` (label_list, optional): additional runtime files. - `working_dir` (string, default: `"workspace"`, values: `"workspace" | "entry_point"`): runtime working directory. ## bun_dev Runs a JS/TS entry point in Bun development watch mode (`bazel run`). Attributes: - `entry_point` (label, required): path to the main JS/TS file. - `watch_mode` (string, default: `"watch"`, values: `"watch" | "hot"`): Bun live-reload mode. - `restart_on` (label_list, optional): files that trigger full process restart when changed. - `node_modules` (label, optional): Bun/npm package files in runfiles. - `data` (label_list, optional): additional runtime files for dev process. - `working_dir` (string, default: `"workspace"`, values: `"workspace" | "entry_point"`): runtime working directory. ## bun_script Runs a named `package.json` script with Bun as an executable target (`bazel run`). Recommended for package-script based tools such as Vite (`dev`, `build`, `preview`). When `node_modules` is provided, executables from `node_modules/.bin` are added to `PATH`, so scripts like `vite` work without wrapper scripts. Attributes: - `script` (string, required): package script name passed to `bun run