Skip to content

Commit 6a06e95

Browse files
committed
pbjs descriptor.proto compatibility; always use Uint8Array in docs for tsd, see #503
1 parent 29ff3f1 commit 6a06e95

File tree

22 files changed

+371
-650
lines changed

22 files changed

+371
-650
lines changed

cli/targets/proto.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ function buildEnum(enm) {
144144
push("}");
145145
}
146146

147+
function buildRanges(keyword, ranges) {
148+
if (ranges && ranges.length) {
149+
push("");
150+
ranges.forEach(function(range) {
151+
if (range[0] === range[1])
152+
push(keyword + " " + range[0] + ";");
153+
else
154+
push(keyword + " " + range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]) + ";");
155+
});
156+
}
157+
}
158+
147159
function buildType(type) {
148160
push("");
149161
push("message " + type.name + " {");
@@ -153,12 +165,8 @@ function buildType(type) {
153165
first = true;
154166
type.fieldsArray.forEach(build);
155167
consolidateExtends(type.nestedArray).remaining.forEach(build);
156-
if (type.extensions && type.extensions.length) {
157-
push("");
158-
type.extensions.forEach(function(range) {
159-
push("extensions " + range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]) + ";");
160-
});
161-
}
168+
buildRanges("extensions", type.extensions);
169+
buildRanges("reserved", type.reserved);
162170
--indent;
163171
push("}");
164172
}

dist/protobuf.js

Lines changed: 38 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.min.js.gz

60 Bytes
Binary file not shown.

dist/protobuf.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

google/protobuf/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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 commit comments

Comments
 (0)