protobufjs 8.8.0 → 8.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/light/protobuf.js +65 -26
- package/dist/light/protobuf.js.map +1 -1
- package/dist/light/protobuf.min.js +3 -3
- package/dist/light/protobuf.min.js.map +1 -1
- package/dist/minimal/protobuf.js +59 -20
- package/dist/minimal/protobuf.js.map +1 -1
- package/dist/minimal/protobuf.min.js +3 -3
- package/dist/minimal/protobuf.min.js.map +1 -1
- package/dist/protobuf.js +79 -29
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/ext/descriptor.js +9 -0
- package/ext/protojson.js +15 -4
- package/google/protobuf/descriptor.json +4 -0
- package/google/protobuf/descriptor.proto +1 -0
- package/google/protobuf/json_enumvalue_options.json +56 -0
- package/google/protobuf/json_enumvalue_options.proto +31 -0
- package/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/decoder.js +5 -5
- package/src/reader.js +56 -17
- package/src/reader_buffer.js +1 -1
- package/src/tokenize.js +14 -3
- package/src/type.js +1 -1
package/dist/minimal/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v8.8.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v8.8.1 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled sun, 11 oct 2026 17:08:01 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -285,6 +285,45 @@ Reader.prototype.tag = function read_tag() {
|
|
|
285
285
|
throw Error("invalid tag encoding");
|
|
286
286
|
};
|
|
287
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Reads a varint length prefix within signed 32 bit range.
|
|
290
|
+
* @returns {number} Length read
|
|
291
|
+
*/
|
|
292
|
+
Reader.prototype.size = function read_size() {
|
|
293
|
+
if (this.len - this.pos < 5) {
|
|
294
|
+
if (this.pos >= this.len)
|
|
295
|
+
throw indexOutOfRange(this);
|
|
296
|
+
if (this.buf[this.pos] >= 128)
|
|
297
|
+
return readVarint32NearEnd(this);
|
|
298
|
+
}
|
|
299
|
+
var buf = this.buf,
|
|
300
|
+
pos = this.pos,
|
|
301
|
+
value = (buf[pos] & 127) >>> 0;
|
|
302
|
+
if (buf[pos++] < 128) {
|
|
303
|
+
this.pos = pos;
|
|
304
|
+
return value;
|
|
305
|
+
}
|
|
306
|
+
value = (value | (buf[pos] & 127) << 7) >>> 0;
|
|
307
|
+
if (buf[pos++] < 128) {
|
|
308
|
+
this.pos = pos;
|
|
309
|
+
return value;
|
|
310
|
+
}
|
|
311
|
+
value = (value | (buf[pos] & 127) << 14) >>> 0;
|
|
312
|
+
if (buf[pos++] < 128) {
|
|
313
|
+
this.pos = pos;
|
|
314
|
+
return value;
|
|
315
|
+
}
|
|
316
|
+
value = (value | (buf[pos] & 127) << 21) >>> 0;
|
|
317
|
+
if (buf[pos++] < 128) {
|
|
318
|
+
this.pos = pos;
|
|
319
|
+
return value;
|
|
320
|
+
}
|
|
321
|
+
this.pos = pos + 1;
|
|
322
|
+
if (buf[pos] > 7)
|
|
323
|
+
throw Error("invalid length encoding");
|
|
324
|
+
return (value | buf[pos] << 28) >>> 0;
|
|
325
|
+
};
|
|
326
|
+
|
|
288
327
|
/**
|
|
289
328
|
* Reads a varint as a signed 32 bit value.
|
|
290
329
|
* @returns {number} Value read
|
|
@@ -498,7 +537,7 @@ Reader.prototype.double = function read_double() {
|
|
|
498
537
|
*/
|
|
499
538
|
Reader.prototype.uint32s = function read_uint32s(array) {
|
|
500
539
|
if (array === undefined) array = [];
|
|
501
|
-
var end = this.
|
|
540
|
+
var end = this.size() + this.pos, len = this.len, buf = this.buf, pos = this.pos, value;
|
|
502
541
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
503
542
|
this.len = end;
|
|
504
543
|
while (pos < end) {
|
|
@@ -524,7 +563,7 @@ Reader.prototype.uint32s = function read_uint32s(array) {
|
|
|
524
563
|
*/
|
|
525
564
|
Reader.prototype.int32s = function read_int32s(array) {
|
|
526
565
|
if (array === undefined) array = [];
|
|
527
|
-
var end = this.
|
|
566
|
+
var end = this.size() + this.pos, len = this.len, buf = this.buf, pos = this.pos, value;
|
|
528
567
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
529
568
|
this.len = end;
|
|
530
569
|
while (pos < end) {
|
|
@@ -550,7 +589,7 @@ Reader.prototype.int32s = function read_int32s(array) {
|
|
|
550
589
|
*/
|
|
551
590
|
Reader.prototype.sint32s = function read_sint32s(array) {
|
|
552
591
|
if (array === undefined) array = [];
|
|
553
|
-
var end = this.
|
|
592
|
+
var end = this.size() + this.pos, len = this.len;
|
|
554
593
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
555
594
|
this.len = end;
|
|
556
595
|
while (this.pos < end)
|
|
@@ -567,7 +606,7 @@ Reader.prototype.sint32s = function read_sint32s(array) {
|
|
|
567
606
|
*/
|
|
568
607
|
Reader.prototype.bools = function read_bools(array) {
|
|
569
608
|
if (array === undefined) array = [];
|
|
570
|
-
var end = this.
|
|
609
|
+
var end = this.size() + this.pos, len = this.len, buf = this.buf, pos = this.pos, value;
|
|
571
610
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
572
611
|
this.len = end;
|
|
573
612
|
while (pos < end) {
|
|
@@ -605,7 +644,7 @@ function getLazyView(reader, count, threshold) {
|
|
|
605
644
|
*/
|
|
606
645
|
Reader.prototype.fixed32s = function read_fixed32s(array) {
|
|
607
646
|
if (array === undefined) array = [];
|
|
608
|
-
var len = this.
|
|
647
|
+
var len = this.size(), end = this.pos + len;
|
|
609
648
|
/* istanbul ignore if */
|
|
610
649
|
if (end > this.len) throw indexOutOfRange(this, len);
|
|
611
650
|
var count = len >>> 2, i = array.length, pos = this.pos;
|
|
@@ -629,7 +668,7 @@ Reader.prototype.fixed32s = function read_fixed32s(array) {
|
|
|
629
668
|
*/
|
|
630
669
|
Reader.prototype.sfixed32s = function read_sfixed32s(array) {
|
|
631
670
|
if (array === undefined) array = [];
|
|
632
|
-
var len = this.
|
|
671
|
+
var len = this.size(), end = this.pos + len;
|
|
633
672
|
/* istanbul ignore if */
|
|
634
673
|
if (end > this.len) throw indexOutOfRange(this, len);
|
|
635
674
|
var count = len >>> 2, i = array.length, pos = this.pos;
|
|
@@ -653,7 +692,7 @@ Reader.prototype.sfixed32s = function read_sfixed32s(array) {
|
|
|
653
692
|
*/
|
|
654
693
|
Reader.prototype.floats = function read_floats(array) {
|
|
655
694
|
if (array === undefined) array = [];
|
|
656
|
-
var len = this.
|
|
695
|
+
var len = this.size(), end = this.pos + len;
|
|
657
696
|
/* istanbul ignore if */
|
|
658
697
|
if (end > this.len) throw indexOutOfRange(this, len);
|
|
659
698
|
var count = len >>> 2, i = array.length, pos = this.pos;
|
|
@@ -677,7 +716,7 @@ Reader.prototype.floats = function read_floats(array) {
|
|
|
677
716
|
*/
|
|
678
717
|
Reader.prototype.doubles = function read_doubles(array) {
|
|
679
718
|
if (array === undefined) array = [];
|
|
680
|
-
var len = this.
|
|
719
|
+
var len = this.size(), end = this.pos + len;
|
|
681
720
|
/* istanbul ignore if */
|
|
682
721
|
if (end > this.len) throw indexOutOfRange(this, len);
|
|
683
722
|
var count = len >>> 3, i = array.length, pos = this.pos;
|
|
@@ -701,7 +740,7 @@ Reader.prototype.doubles = function read_doubles(array) {
|
|
|
701
740
|
*/
|
|
702
741
|
Reader.prototype.uint64s = function read_uint64s(array) {
|
|
703
742
|
if (array === undefined) array = [];
|
|
704
|
-
var end = this.
|
|
743
|
+
var end = this.size() + this.pos, len = this.len;
|
|
705
744
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
706
745
|
this.len = end;
|
|
707
746
|
while (this.pos < end)
|
|
@@ -718,7 +757,7 @@ Reader.prototype.uint64s = function read_uint64s(array) {
|
|
|
718
757
|
*/
|
|
719
758
|
Reader.prototype.int64s = function read_int64s(array) {
|
|
720
759
|
if (array === undefined) array = [];
|
|
721
|
-
var end = this.
|
|
760
|
+
var end = this.size() + this.pos, len = this.len;
|
|
722
761
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
723
762
|
this.len = end;
|
|
724
763
|
while (this.pos < end)
|
|
@@ -735,7 +774,7 @@ Reader.prototype.int64s = function read_int64s(array) {
|
|
|
735
774
|
*/
|
|
736
775
|
Reader.prototype.sint64s = function read_sint64s(array) {
|
|
737
776
|
if (array === undefined) array = [];
|
|
738
|
-
var end = this.
|
|
777
|
+
var end = this.size() + this.pos, len = this.len;
|
|
739
778
|
if (end > len) throw indexOutOfRange(this, end - this.pos);
|
|
740
779
|
this.len = end;
|
|
741
780
|
while (this.pos < end)
|
|
@@ -752,7 +791,7 @@ Reader.prototype.sint64s = function read_sint64s(array) {
|
|
|
752
791
|
*/
|
|
753
792
|
Reader.prototype.fixed64s = function read_fixed64s(array) {
|
|
754
793
|
if (array === undefined) array = [];
|
|
755
|
-
var len = this.
|
|
794
|
+
var len = this.size(), end = this.pos + len, i = array.length;
|
|
756
795
|
/* istanbul ignore if */
|
|
757
796
|
if (end > this.len) throw indexOutOfRange(this, len);
|
|
758
797
|
var count = len >>> 3;
|
|
@@ -770,7 +809,7 @@ Reader.prototype.fixed64s = function read_fixed64s(array) {
|
|
|
770
809
|
*/
|
|
771
810
|
Reader.prototype.sfixed64s = function read_sfixed64s(array) {
|
|
772
811
|
if (array === undefined) array = [];
|
|
773
|
-
var len = this.
|
|
812
|
+
var len = this.size(), end = this.pos + len, i = array.length;
|
|
774
813
|
/* istanbul ignore if */
|
|
775
814
|
if (end > this.len) throw indexOutOfRange(this, len);
|
|
776
815
|
var count = len >>> 3;
|
|
@@ -786,7 +825,7 @@ Reader.prototype.sfixed64s = function read_sfixed64s(array) {
|
|
|
786
825
|
* @returns {Uint8Array} Value read
|
|
787
826
|
*/
|
|
788
827
|
Reader.prototype.bytes = function read_bytes() {
|
|
789
|
-
var length = this.
|
|
828
|
+
var length = this.size(),
|
|
790
829
|
start = this.pos,
|
|
791
830
|
end = this.pos + length;
|
|
792
831
|
|
|
@@ -803,7 +842,7 @@ Reader.prototype.bytes = function read_bytes() {
|
|
|
803
842
|
* @returns {string} Value read
|
|
804
843
|
*/
|
|
805
844
|
Reader.prototype.string = function read_string() {
|
|
806
|
-
var length = this.
|
|
845
|
+
var length = this.size(),
|
|
807
846
|
start = this.pos,
|
|
808
847
|
end = this.pos + length;
|
|
809
848
|
|
|
@@ -820,7 +859,7 @@ Reader.prototype.string = function read_string() {
|
|
|
820
859
|
* @returns {string} Value read
|
|
821
860
|
*/
|
|
822
861
|
Reader.prototype.stringVerify = function read_string_verify() {
|
|
823
|
-
var length = this.
|
|
862
|
+
var length = this.size(),
|
|
824
863
|
start = this.pos,
|
|
825
864
|
end = this.pos + length;
|
|
826
865
|
|
|
@@ -886,7 +925,7 @@ Reader.prototype.skipType = function(wireType, depth, fieldNumber) {
|
|
|
886
925
|
this.skip(8);
|
|
887
926
|
break;
|
|
888
927
|
case 2:
|
|
889
|
-
this.skip(this.
|
|
928
|
+
this.skip(this.size());
|
|
890
929
|
break;
|
|
891
930
|
case 3:
|
|
892
931
|
while (true) {
|
|
@@ -1001,7 +1040,7 @@ BufferReader.prototype.raw = function read_raw_buffer(start, end) {
|
|
|
1001
1040
|
* @override
|
|
1002
1041
|
*/
|
|
1003
1042
|
BufferReader.prototype.string = function read_string_buffer() {
|
|
1004
|
-
var len = this.
|
|
1043
|
+
var len = this.size(), // modifies pos
|
|
1005
1044
|
start = this.pos,
|
|
1006
1045
|
end = this.pos + len;
|
|
1007
1046
|
|