0.1.0 • Published 8 months ago

bun-plugin-proto v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

bun-plugin-proto

Adds support for .proto imports in Bun.

Installation

bun add bun-plugin-proto -d

Bundler usage

import proto from "bun-plugin-proto";

Bun.build({
  // other config
  plugins: [
    proto()
  ],
});

In your sources you can now import proto files

import packageDefinition from './file.proto'

console.log(packageDefinition)

The contents of the packageDefinition will be inlined into your bundle.

Runtime usage

To use as a runtime plugin, create a file that registers the plugin:

// proto.ts
import proto from 'bun-plugin-proto'

Bun.plugin(proto({}));

Then preload it in your bunfig.toml:

preload = ['./proto.ts']

License

MIT

0.1.0

8 months ago