{"id":16489080,"url":"https://github.com/thundernet8/proto-splitter","last_synced_at":"2025-10-27T20:31:14.452Z","repository":{"id":65476016,"uuid":"291237167","full_name":"thundernet8/proto-splitter","owner":"thundernet8","description":"Split protobuf files into single method protos and tree shaking","archived":false,"fork":false,"pushed_at":"2020-09-04T10:43:56.000Z","size":242,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T22:01:43.140Z","etag":null,"topics":["protobuf","protobuf-packing","protobuf-tree-shaking"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thundernet8.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-29T09:03:11.000Z","updated_at":"2023-10-14T08:49:42.000Z","dependencies_parsed_at":"2023-01-25T06:15:28.324Z","dependency_job_id":null,"html_url":"https://github.com/thundernet8/proto-splitter","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundernet8%2Fproto-splitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundernet8%2Fproto-splitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundernet8%2Fproto-splitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundernet8%2Fproto-splitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thundernet8","download_url":"https://codeload.github.com/thundernet8/proto-splitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238553071,"owners_count":19491368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["protobuf","protobuf-packing","protobuf-tree-shaking"],"created_at":"2024-10-11T13:42:59.245Z","updated_at":"2025-10-27T20:31:09.037Z","avatar_url":"https://github.com/thundernet8.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Proto-Splitter\n\nSplit protobuf files into single method protos and tree shaking\n\n## Install\n\n```bash\nyarn add proto-splitter\n```\n\n## Usage\n\n```ts\nimport { getProtoRoutes } from 'proto-splitter';\n\nconst file = '/your_proto_file_path';\n(async function() {\n    const routes = await getProtoRoutes(file, { format: true });\n    console.log(routes);\n})();\n```\n\n### Example\n\n```protobuf\n# source a.proto\nsyntax = \"proto3\";\npackage a;\n\nmessage PostType {\n    enum Enum {\n        V1 = 0;\n        V2 = 1;\n    }\n}\n\n# source b.proto\nsyntax = \"proto3\";\npackage b;\n\nimport \"a.proto\";\n\nmessage GetPostReq {\n    int32 id = 1;\n}\n\nmessage Post {\n    string title = 1;\n    int32 id = 2;\n    string content = 3;\n    PostType.Enum type = 4;\n}\n\nmessage GetPostListReq {\n    int32 page_size = 1;\n    int32 page = 2;\n}\n\nmessage GetPostListResp {\n    repeated Post post = 1;\n    int32 total = 2;\n}\n\nservice PostService {\n    rpc GetPost(GetPostReq) returns (Post);\n    rpc GetPostList(GetPostListReq) returns (GetPostListResp);\n}\n```\n\nwill be\n\n```protobuf\n# output two routes\n# 1\nsyntax = \"proto3\";\npackage mono;\nmessage ME1 {\n  enum E {\n    V1 = 0;\n    V2 = 1;\n  }\n}\nmessage M1 {\n  int32 id = 1;\n}\nmessage M2 {\n  string title = 1;\n  int32 id = 2;\n  string content = 3;\n  ME1.E type = 4;\n}\nservice Mono {\n  rpc Call(M1) returns (M2);\n}\n\n# 2\nsyntax = \"proto3\";\npackage mono;\nmessage ME1 {\n  enum E {\n    V1 = 0;\n    V2 = 1;\n  }\n}\nmessage M1 {\n  int32 page_size = 1;\n  int32 page = 2;\n}\nmessage M2 {\n  repeated M3 post = 1;\n  int32 total = 2;\n}\nmessage M3 {\n  string title = 1;\n  int32 id = 2;\n  string content = 3;\n  ME1.E type = 4;\n}\nservice Mono {\n  rpc Call(M1) returns (M2);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthundernet8%2Fproto-splitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthundernet8%2Fproto-splitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthundernet8%2Fproto-splitter/lists"}