@arkenv/bun-plugin

Exports and transform options for the Bun plugin.

Edit on GitHub

API reference for @arkenv/bun-plugin. Setup recipes: Bun guide. Backend-only Bun scripts use @arkenv/core without this plugin.

Installation

npm install -D @arkenv/bun-plugin
npm install @arkenv/core arktype
pnpm add -D @arkenv/bun-plugin
pnpm add @arkenv/core arktype
yarn add --dev @arkenv/bun-plugin
yarn add @arkenv/core arktype
bun install --dev @arkenv/bun-plugin
bun install @arkenv/core arktype

Or if you use Zod, Valibot, or another Standard Schema validator:

npm install -D @arkenv/bun-plugin
npm install @arkenv/standard
pnpm add -D @arkenv/bun-plugin
pnpm add @arkenv/standard
yarn add --dev @arkenv/bun-plugin
yarn add @arkenv/standard
bun install --dev @arkenv/bun-plugin
bun install @arkenv/standard

Exports

ExportRole
defaultarkenvPlugin hybrid plugin instance
named arkenvPluginHybrid plugin factory and instance
named arkenvBunPluginHost-explicit named alias
named hybridExplicit zero-config hybrid plugin alias
./standardStandard Schema plugin entry

arkenvPlugin is both a factory (arkenvPlugin({ schemaPath })) and a BunPlugin object with name, target, and setup. You can preload in bunfig.toml (plugins = ["@arkenv/bun-plugin"]), register in Bun.build, or pass transform options. Default client prefix: BUN_PUBLIC_.

Transform options

Same transform call shape as @arkenv/vite-plugin:

OptionDefaultMeaning
schemaPathauto (env.ts)Schema module to transform
clientPrefixBUN_PUBLIC_Keys exposed to the client
Plus(none)All ArkEnvConfig fields except safe
logger / logLevel(none)Logging

A schema argument is rejected. Plugin config omits safe so failed validation cannot soft-fail into the bundle.

Next steps