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

pb-hxj

v8.0.1

Published

Egret protobuf scaffold based on protobufjs 8.x

Readme

@your-npm-username/protobuf8

基于 Node.js 重写的 Protobuf 脚手架,目标是兼容 protobufjs 8.x,并修复 Windows 下 pbjs 命令冲突问题。

特性

  • 使用 protobufjs 8.x + protobufjs-cli 2.x
  • add / init:初始化 protobuf 目录、复制运行时;在存在 egretProperties.json 时自动补充 Egret 配置
  • generate:从 .proto 生成 bundles/protobuf-bundles.js/.min.js/.d.ts
  • 生成产物兼容浏览器全局、Egret、Cocos 常见脚本环境
  • 内置声明修复:自动清洗 ['object'].<string, any>Object.<string, *>let xxx?: 等异常类型片段

安装

npm install @your-npm-username/protobuf8

使用

# 在项目根目录执行
npx pb-hxj init
npx pb-hxj generate

也可以直接用 Node:

node src/cli.js init <项目目录>
node src/cli.js generate <项目目录>

## Cocos 使用说明

如果你是在 Cocos 项目下使用,必须保证加载顺序:

1. 先加载 protobuf/library/protobuf-library.js
2. 再加载 protobuf/bundles/protobuf-bundles.js

生成后的 bundles 会自动把 protobuf.roots.default 下的顶级 package 挂到全局,例如 package CommonProto 会暴露为全局 CommonProto。

如果你使用的是 Cocos Creator 的模块脚本体系,不要假设普通脚本会自动进入同一个模块作用域。优先把这两个文件作为普通插件脚本按顺序引入,或者在启动阶段显式先加载运行时,再加载 bundles。

发布到 npm

npm login
npm run pack:check
npm publish

当前版本已配置为作用域公开包发布,默认使用 beta tag。

发布前请先把包名中的 your-npm-username 替换成你自己的 npm 用户名。

默认目录结构

protobuf/
  library/
    protobuf-library.js
    protobuf-library.min.js
    protobuf-library.d.ts
  protofile/
  bundles/
  pbconfig.json

pbconfig.json

{
  "options": {
    "no-create": false,
    "no-verify": false,
    "no-convert": true,
    "no-delimited": false
  },
  "sourceRoot": "protofile",
  "outputFile": "bundles/protobuf-bundles.js"
}