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 🙏

© 2024 – Pkg Stats / Ryan Hefner

protofile-loader

v1.1.1

Published

import .proto file on webpack buildjs

Downloads

3

Readme

protofile-loader

import .proto file on webpack buildjs

  1. 由于protobufjs加载.proto文件时需要通过.load的方式,这样子会将.proto文件完全暴露出来,因此想通过webpack工具将.proto文件转成JS对象在编译的时候直接加载
  2. 通过protobuf-loader以及proto-loader两个现有的插件找到将root输出的方式
  3. 由于json文件格式编译出来的代码量比较大因此当前只支持了.proto文件的转换后期看情况去使用json-module去转换
  4. options设置
    • create: false, // 对象是否输出create 方法
    • verify: false, // 对象是否输出verify 方法
    • convert: false, // 对象是否输出convert(fromObject|toObject) 方法
    • delimited: true, // 对象是否输出encodeDelimited|decodeDelimited 方法
    • encode: true, // 对象输出encode 方法
    • decode: true, // 对象输出decode 方法
    • es6:false,//是否输出Es6的变量声明let|const
    • beautify: false, // 是否美化生成的代码
    • comments: false, //注释内容是否保留,依赖于root里面是否有comment参数
    • forceLong:false,//sfixed64 强制long
    • forceNumber:false,//sfixed64 强制number;
    • forceMessage:false,
    • forceEnumString:false,//枚举的输出
  5. 通过.proto?create=true以参数的形式定制化不同的对象输出,减少一次性输出所有的对象