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: 6 months ago
JSON representation
Adds support for .proto imports in Bun.
- Host: GitHub
- URL: https://github.com/wobsoriano/bun-plugin-proto
- Owner: wobsoriano
- License: mit
- Created: 2023-09-11T16:36:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-12T20:08:35.000Z (almost 3 years ago)
- Last Synced: 2025-03-11T02:02:41.076Z (over 1 year ago)
- Topics: bun, plugin, proto
- Language: TypeScript
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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