{"id":28717236,"url":"https://github.com/edvardchen/protobuf-jsx","last_synced_at":"2025-06-15T03:13:57.256Z","repository":{"id":40307768,"uuid":"245084080","full_name":"edvardchen/protobuf-jsx","owner":"edvardchen","description":"create statically generated message object from jsx","archived":false,"fork":false,"pushed_at":"2023-07-18T21:10:38.000Z","size":956,"stargazers_count":5,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-29T02:17:30.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edvardchen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-05T06:14:46.000Z","updated_at":"2023-08-20T11:25:14.000Z","dependencies_parsed_at":"2023-02-03T22:00:33.555Z","dependency_job_id":null,"html_url":"https://github.com/edvardchen/protobuf-jsx","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/edvardchen/protobuf-jsx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardchen%2Fprotobuf-jsx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardchen%2Fprotobuf-jsx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardchen%2Fprotobuf-jsx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardchen%2Fprotobuf-jsx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edvardchen","download_url":"https://codeload.github.com/edvardchen/protobuf-jsx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edvardchen%2Fprotobuf-jsx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259914929,"owners_count":22931334,"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":[],"created_at":"2025-06-15T03:13:51.036Z","updated_at":"2025-06-15T03:13:57.211Z","avatar_url":"https://github.com/edvardchen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protobuf-jsx\n\ncreate statically generated message object from jsx\n\n## Why\n\nWhile we use statically generated javascript code,\nwe can't simply create `Message` object from plain object\ndue to missing `fromObject` method (as the reverse of `toObject`)\n\nSee more in [this issue](https://github.com/protocolbuffers/protobuf/issues/1591)\n\nBefore official support for `fromObject` method, we can use `protobuf-jsx` as a friendly workaround.\n\n## Installation\n\n```bash\nnpm i -S protobuf-jsx\n```\n\n## Usage\n\n1. Enable `jsx` in `tsconfig.json`\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react\",\n    \"jsxFactory\": \"Protobuf.createMessage\"\n  }\n}\n```\n\n\u003e If you don't use TypeScript, check out how to register jsx factory for your tool chain.\n\n2. Write `jsx` in your javascript file.\n\n```js\nimport Protobuf from '../src';\nimport { Feature, Point } from './fixtures/static_codegen/route_guide_pb';\n\nconst feature: Feature = (\n  \u003cFeature name=\"hello\" location={\u003cPoint {...point} /\u003e}\u003e\u003c/Feature\u003e\n);\n\n// or using children render function\n\nconst feature: Feature = (\n  \u003cFeature name=\"hello\"\u003e{() =\u003e ({ location: \u003cPoint {...point} /\u003e })}\u003c/Feature\u003e\n);\n```\n\n## Work with eslint\n\nThe following configurations prevent variables used in JSX to be marked as unused.\n\n````yml\nrules:\n  react/jsx-uses-vars: 2\nplugins:\n  - react```\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedvardchen%2Fprotobuf-jsx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedvardchen%2Fprotobuf-jsx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedvardchen%2Fprotobuf-jsx/lists"}