@wireio/protoc-gen-solana 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A `protoc` plugin that generates Rust protobuf encode/decode modules from proto3
|
|
|
4
4
|
|
|
5
5
|
Given a `.proto` file, the plugin outputs:
|
|
6
6
|
|
|
7
|
-
- A `.
|
|
7
|
+
- A `.rs` file per proto file containing Rust structs with `encode()` / `decode()` methods
|
|
8
8
|
- A shared `protobuf_runtime.rs` with wire format primitives (varint, fixed, zigzag, length-delimited)
|
|
9
9
|
|
|
10
10
|
Generated code targets minimal allocations and efficient compute, suitable for Solana's on-chain constraints.
|
|
@@ -15,12 +15,12 @@ Generated code targets minimal allocations and efficient compute, suitable for S
|
|
|
15
15
|
npm install @wireio/protoc-gen-solana
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Requires Node >= 24
|
|
18
|
+
Requires Node >= 24 on your PATH.
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
protoc \
|
|
23
|
+
[npx] protoc \
|
|
24
24
|
--plugin=protoc-gen-solana=./node_modules/.bin/protoc-gen-solana \
|
|
25
25
|
--solana_out=./generated \
|
|
26
26
|
path/to/your.proto
|
|
@@ -31,7 +31,7 @@ protoc \
|
|
|
31
31
|
Pass parameters via `--solana_opt`:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
protoc --solana_opt=log_level=debug ...
|
|
34
|
+
[npx] protoc --solana_opt=log_level=debug ...
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
| Parameter | Values | Default |
|
|
@@ -114,7 +114,7 @@ For a proto file `path/to/service.proto` with `package example.nested`:
|
|
|
114
114
|
```
|
|
115
115
|
<output_dir>/
|
|
116
116
|
protobuf_runtime.rs # Always emitted — shared wire format primitives
|
|
117
|
-
example/nested/service.
|
|
117
|
+
example/nested/service.rs # Per-proto generated structs
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
The generated code imports the runtime via `use crate::protobuf_runtime::*;`, so both files should live in the same Rust crate.
|
|
Binary file
|
|
@@ -7046,7 +7046,7 @@ function protoFileToRsFile(protoFile, packageName) {
|
|
|
7046
7046
|
const parts = base.split("/");
|
|
7047
7047
|
const filename = parts[parts.length - 1];
|
|
7048
7048
|
const snakeFilename = filename.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
7049
|
-
const rsBasename = `${snakeFilename}.
|
|
7049
|
+
const rsBasename = `${snakeFilename}.rs`;
|
|
7050
7050
|
if (!packageName) return rsBasename;
|
|
7051
7051
|
const dir = packageName.split(".").join("/");
|
|
7052
7052
|
return `${dir}/${rsBasename}`;
|