Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wobsoriano/bun-plugin-proto

Adds support for .proto imports in Bun.
https://github.com/wobsoriano/bun-plugin-proto

bun plugin proto

Last synced: 30 days ago
JSON representation

Adds support for .proto imports in Bun.

Awesome Lists containing this project

README

        

# bun-plugin-proto

Adds support for .proto imports in Bun.

## Installation

```bash
bun add bun-plugin-proto -d
```

## Bundler usage

```ts
import proto from "bun-plugin-proto";

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

In your sources you can now import proto files

```ts
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:

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

Bun.plugin(proto({}));
```

Then preload it in your `bunfig.toml`:

```toml
preload = ['./proto.ts']
```

## License

MIT