Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/wobsoriano/bun-plugin-proto
- Owner: wobsoriano
- License: mit
- Created: 2023-09-11T16:36:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-12T20:08:35.000Z (over 1 year ago)
- Last Synced: 2024-11-19T14:56:19.175Z (about 1 month 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