Bun plugin for boperators that ensures operator overloads work when running TypeScript files directly with Bun, instead of requiring an intermediate transform step.
Requires Bun ≥ 1.3.0. Older versions have a known bug where preloaded plugins prevent TypeScript files from being transpiled correctly.
bun add -D boperators @boperators/plugin-bunThis plugin is enabled in your Bun config file, bunfig.toml:
preload = ["./node_modules/@boperators/plugin-bun/index.ts"]Alternatively, instead of a long file path, create a preload.ts file in your project root:
import "@boperators/plugin-bun";and reference that in your bunfig.toml:
preload = ["./preload.ts"]Bun's runtime plugin API (OnLoadResult) does not support returning a source map from onLoad callbacks. This means breakpoints will land on the transformed code (e.g. Vec2["+"](a, b)) rather than the original operator expression (e.g. a + b). The webpack loader and Vite plugin do not have this limitation.
| Approach | When it runs | Use case |
|---|---|---|
@boperators/cli |
Before compilation | Batch transform to disk, then compile normally |
@boperators/plugin-tsc |
During compilation | Seamless tsc integration, no intermediate files |
@boperators/webpack-loader |
During bundling | Webpack projects, integrates into existing build pipeline |
@boperators/plugin-vite |
During bundling | Vite projects, integrates into Rollup-based pipeline |
@boperators/plugin-esbuild |
During bundling | ESBuild projects, fast bundler integration |
@boperators/plugin-bun |
At runtime | Bun-only, transforms on module load |
MIT
