Skip to content

Commit

Permalink
pbjs descriptor.proto compatibility; always use Uint8Array in docs fo…
Browse files Browse the repository at this point in the history
…r tsd, see #503
  • Loading branch information
dcodeIO committed Nov 30, 2016
1 parent 29ff3f1 commit 6a06e95
Show file tree
Hide file tree
Showing 22 changed files with 371 additions and 650 deletions.
20 changes: 14 additions & 6 deletions cli/targets/proto.js
Expand Up @@ -144,6 +144,18 @@ function buildEnum(enm) {
push("}");
}

function buildRanges(keyword, ranges) {
if (ranges && ranges.length) {
push("");
ranges.forEach(function(range) {
if (range[0] === range[1])
push(keyword + " " + range[0] + ";");
else
push(keyword + " " + range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]) + ";");
});
}
}

function buildType(type) {
push("");
push("message " + type.name + " {");
Expand All @@ -153,12 +165,8 @@ function buildType(type) {
first = true;
type.fieldsArray.forEach(build);
consolidateExtends(type.nestedArray).remaining.forEach(build);
if (type.extensions && type.extensions.length) {
push("");
type.extensions.forEach(function(range) {
push("extensions " + range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]) + ";");
});
}
buildRanges("extensions", type.extensions);
buildRanges("reserved", type.reserved);
--indent;
push("}");
}
Expand Down
84 changes: 38 additions & 46 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions google/protobuf/README.md
@@ -0,0 +1 @@
This folder contains stripped and pre-parsed definitions of common Google types. These files are not used by protobuf.js directly but are here so you can use or include them where required.

0 comments on commit 6a06e95

Please sign in to comment.