UNPKG

bun-plugin-zon

Version:

A bun plugin for loading Zig's ZON (Zig Object Notation) files in your Bun projects.

21 lines (17 loc) 425 B
import { plugin } from 'bun'; await plugin({ name: 'ZON', async setup(build) { const { ZON } = await import('zzon'); build.onLoad({ filter: /\.(zon)$/ }, async (args) => { const text = await Bun.file(args.path).text(); const zon = ZON.parse(text) as Record<string, any>; return { loader: 'object', exports: { default: zon, }, }; }); }, });