npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

protoc-gen-arkts

v0.5.0

Published

面向 HarmonyOS 的 ArkTS Protobuf message 代码生成器

Readme

protoc-gen-arkts

面向 HarmonyOS ArkTS 的 protoc 生成器插件。

支持范围

  • proto3 message、enum 和嵌套类型
  • 全部标准标量类型
  • singular、repeated、packed/unpacked 字段
  • proto3 optional 显式 presence
  • map、oneof 和跨文件引用
  • Protobuf 二进制编码与解码
  • 可选生成 proto3 canonical JSON
  • Empty、Wrappers、NullValue、Timestamp、Duration、FieldMask、Struct、Value、ListValue 和 Any
  • 为 unary service 生成强类型调用类与静态响应解码入口
  • 多协议目录分组和跨组 import

不支持范围

  • proto2
  • Editions
  • TextFormat
  • group 和 extensions
  • 解码后保留并重新写出未知字段

环境要求

  • Node.js 22 或更高版本
  • protoc 已安装并加入 PATH
  • 生成代码所在的 HarmonyOS 模块已安装 protoc-gen-arkts-runtime

安装

全局安装:

npm install -g protoc-gen-arkts

安装为项目开发依赖:

npm install --save-dev protoc-gen-arkts

使用

生成二进制编解码代码:

protoc \
  -I proto \
  --arkts_out=entry/src/main/ets/generated \
  proto/greeting.proto

项目内安装时指定插件位置:

protoc \
  -I proto \
  --plugin=protoc-gen-arkts=./node_modules/.bin/protoc-gen-arkts \
  --arkts_out=entry/src/main/ets/generated \
  proto/greeting.proto

启用 JSON:

protoc \
  -I proto \
  --arkts_out=json=true:entry/src/main/ets/generated \
  proto/greeting.proto

插件参数:

| 参数 | 默认值 | 用途 | | --- | --- | --- | | json | false | 生成 proto3 JSON API | | output_prefix | 空 | 当前协议的输出目录前缀 | | dep_root | 空 | 外部依赖协议所在的 -I 根目录 | | dep_prefix | 同 output_prefix | 外部依赖协议的输出目录前缀 |

完整使用说明见项目 README。

许可证

Apache License 2.0