Skip to content

Commit 8d4574c

Browse files
committed
feat: add modified module definition for php protobufs
1 parent 0a915ee commit 8d4574c

File tree

9 files changed

+937
-0
lines changed

9 files changed

+937
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ generate: install
1919
protoc --experimental_allow_proto3_optional \
2020
--rust_out=proto/v1/src \
2121
--go_out=proto/v1/go \
22+
--php_out=proto/v1/php \
2223
proto/v1/api.proto
2324

25+
generate-php: install
26+
protoc --experimental_allow_proto3_optional \
27+
--php_out=proto/v1/php \
28+
proto/v1/module-no-option.proto
29+
2430
generate-web-list-mods-response:
2531
cd scripts/protobuf-list-modules-response && cargo run --release -- $(take)
2632
mv scripts/protobuf-list-modules-response/ListModulesResponse.pb api/

proto/v1/module-no-option.proto

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
syntax = "proto3";
2+
3+
import "google/protobuf/timestamp.proto";
4+
5+
// Used to type the arguments and return types from wasm elements such as import
6+
// and export functions.
7+
enum ValType {
8+
I32 = 0;
9+
I64 = 1;
10+
F32 = 2;
11+
F64 = 3;
12+
V128 = 4;
13+
FuncRef = 5;
14+
ExternRef = 6;
15+
}
16+
17+
// Contained by an import or export element within a wasm binary.
18+
message Function {
19+
repeated ValType params = 1;
20+
repeated ValType results = 2;
21+
string name = 3;
22+
}
23+
24+
// A function and module namespace that is defined outside of the current
25+
// module, and referenced & called by the current module.
26+
message Import {
27+
string module_name = 1;
28+
Function func = 2;
29+
}
30+
31+
// A function that is defined inside the current module, made available to
32+
// outside modules / environments.
33+
message Export { Function func = 1; }
34+
35+
// The language (or most similar match) used to produce a wasm module.
36+
enum SourceLanguage {
37+
Unknown = 0;
38+
Rust = 1;
39+
Go = 2;
40+
C = 3;
41+
Cpp = 4;
42+
AssemblyScript = 5;
43+
Swift = 6;
44+
JavaScript = 7;
45+
Haskell = 8;
46+
Zig = 9;
47+
}
48+
49+
// Details about a wasm module, either extracted directly from the binary, or
50+
// inferred somehow.
51+
message Module {
52+
// ID for this module, generated by the database.
53+
int64 id = 1;
54+
// sha256 hash of the modules raw bytes
55+
string hash = 3;
56+
// function imports called by the module (see:
57+
// <https://github.com/WebAssembly/design/blob/main/Modules.md#imports)>
58+
repeated Import imports = 4;
59+
// function exports provided by the module (see:
60+
// <https://github.com/WebAssembly/design/blob/main/Modules.md#exports)>
61+
repeated Export exports = 5;
62+
// size in bytes of the module
63+
uint64 size = 6;
64+
// path or locator to the module
65+
string location = 7;
66+
// programming language used to produce this module
67+
SourceLanguage source_language = 8;
68+
// arbitrary metadata provided by the operator of this module
69+
map<string, string> metadata = 9;
70+
// timestamp when this module was loaded and stored
71+
google.protobuf.Timestamp inserted_at = 10;
72+
// the interned strings stored in the wasm binary (panic/abort messages, etc.)
73+
repeated string strings = 11;
74+
// function hashes
75+
map<string, string> function_hashes = 15;
76+
}
77+

proto/v1/php/Export.php

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/v1/php/GPBMetadata/Proto/V1/ModuleNoOption.php

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/v1/php/Import.php

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)