Package Exports
- protoc3
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (protoc3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
背景
- 使用诉求。在前后端开发协作中,将用于协议编写的
proto文档转换为ts的类型定义文件。 - 使用痛点。公司内网或者并未翻墙的开发者,github存在无法访问或者访问速度很差的情况,
https://www.npmjs.com/package/protoc,原有的protoc包大概率出现安装失败的情况。
改进点
- 将支持的protoc版本从
3.11.2升级到3.18.1。 - 使用
本地包来代替从指定的github下载地址下载,避免网络问题导致安装失败。 - 修复现有包对后续版本支持的问题。现有的包在对压缩包遍历时,只能支持单节点目录,假定所有的包里面只有
bin目录,对于多目录压缩后的包,出现定位执行文件失败。
支持PB版本
- 3.18.1
支持操作系统平台
- darwin
- linux
- windows(在
git bash下运行sh)
示例
var protoc = require("protoc");
protoc.library(["path/to/file.proto", "path/to/file2.proto"], function(err, files) {
if (err) return console.error(err);
// Handle the JavaScript Vinyl files.
// These files can be used in Google Closure Compiler,
// but they require the files in
// https://github.com/google/protobuf/tree/master/js
// ...
});