protobufjs 8.4.0 → 8.4.2
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/README.md +45 -31
- package/dist/light/protobuf.js +112 -78
- 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 +41 -19
- 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 +121 -84
- 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 +31 -9
- package/index.d.ts +20 -8
- package/package.json +1 -1
- package/src/converter.js +9 -6
- package/src/decoder.js +3 -1
- package/src/encoder.js +8 -5
- package/src/enum.js +2 -2
- package/src/field.js +2 -5
- package/src/index-light.js +1 -1
- package/src/message.js +1 -1
- package/src/namespace.js +1 -1
- package/src/object.js +6 -6
- package/src/parse.js +9 -6
- package/src/root.js +14 -8
- package/src/type.js +8 -8
- package/src/typescript.js +6 -0
- package/src/util/eventemitter.js +4 -2
- package/src/util/minimal.js +24 -6
- package/src/util/patterns.js +0 -1
- package/src/util.js +2 -3
- package/src/wrappers.js +11 -8
- package/src/writer.js +11 -9
package/dist/minimal/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v8.4.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v8.4.2 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled fri, 22 may 2026 02:44:15 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -1103,7 +1103,7 @@ function EventEmitter() {
|
|
|
1103
1103
|
* @type {Object.<string,*>}
|
|
1104
1104
|
* @private
|
|
1105
1105
|
*/
|
|
1106
|
-
this._listeners =
|
|
1106
|
+
this._listeners = Object.create(null);
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
1109
1109
|
/**
|
|
@@ -1137,12 +1137,14 @@ EventEmitter.prototype.on = function on(evt, fn, ctx) {
|
|
|
1137
1137
|
*/
|
|
1138
1138
|
EventEmitter.prototype.off = function off(evt, fn) {
|
|
1139
1139
|
if (evt === undefined)
|
|
1140
|
-
this._listeners =
|
|
1140
|
+
this._listeners = Object.create(null);
|
|
1141
1141
|
else {
|
|
1142
1142
|
if (fn === undefined)
|
|
1143
1143
|
this._listeners[evt] = [];
|
|
1144
1144
|
else {
|
|
1145
1145
|
var listeners = this._listeners[evt];
|
|
1146
|
+
if (!listeners)
|
|
1147
|
+
return this;
|
|
1146
1148
|
for (var i = 0; i < listeners.length;)
|
|
1147
1149
|
if (listeners[i].fn === fn)
|
|
1148
1150
|
listeners.splice(i, 1);
|
|
@@ -1779,6 +1781,18 @@ util.pool = require(14);
|
|
|
1779
1781
|
// utility to work with the low and high bits of a 64 bit value
|
|
1780
1782
|
util.LongBits = require(12);
|
|
1781
1783
|
|
|
1784
|
+
/**
|
|
1785
|
+
* Tests if the specified key can affect object prototypes.
|
|
1786
|
+
* @memberof util
|
|
1787
|
+
* @param {string} key Key to test
|
|
1788
|
+
* @returns {boolean} `true` if the key is unsafe
|
|
1789
|
+
*/
|
|
1790
|
+
function isUnsafeProperty(key) {
|
|
1791
|
+
return key === "__proto__" || key === "prototype" || key === "constructor";
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
util.isUnsafeProperty = isUnsafeProperty;
|
|
1795
|
+
|
|
1782
1796
|
/**
|
|
1783
1797
|
* Whether running within node or not.
|
|
1784
1798
|
* @memberof util
|
|
@@ -2013,15 +2027,21 @@ util.boolFromKey = function boolFromKey(key) {
|
|
|
2013
2027
|
* Merges the properties of the source object into the destination object.
|
|
2014
2028
|
* @memberof util
|
|
2015
2029
|
* @param {Object.<string,*>} dst Destination object
|
|
2016
|
-
* @param {Object.<string
|
|
2017
|
-
* @param {boolean} [ifNotSet=false] Merges only if the key is not already set
|
|
2030
|
+
* @param {...(Object.<string,*>|boolean)} src Source objects, optionally followed by an `ifNotSet` flag
|
|
2018
2031
|
* @returns {Object.<string,*>} Destination object
|
|
2019
2032
|
*/
|
|
2020
|
-
function merge(dst
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2033
|
+
function merge(dst) { // used by converters
|
|
2034
|
+
var ifNotSet = typeof arguments[arguments.length - 1] === "boolean",
|
|
2035
|
+
limit = ifNotSet ? arguments.length - 1 : arguments.length;
|
|
2036
|
+
ifNotSet = ifNotSet && arguments[arguments.length - 1];
|
|
2037
|
+
for (var a = 1; a < limit; ++a) {
|
|
2038
|
+
var src = arguments[a];
|
|
2039
|
+
if (!src)
|
|
2040
|
+
continue;
|
|
2041
|
+
for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
|
|
2042
|
+
if (!isUnsafeProperty(keys[i]) && (dst[keys[i]] === undefined || !ifNotSet))
|
|
2024
2043
|
dst[keys[i]] = src[keys[i]];
|
|
2044
|
+
}
|
|
2025
2045
|
return dst;
|
|
2026
2046
|
}
|
|
2027
2047
|
|
|
@@ -2668,7 +2688,7 @@ Writer.prototype.uint32 = function write_uint32(value) {
|
|
|
2668
2688
|
* @returns {Writer} `this`
|
|
2669
2689
|
*/
|
|
2670
2690
|
Writer.prototype.int32 = function write_int32(value) {
|
|
2671
|
-
return value < 0
|
|
2691
|
+
return (value |= 0) < 0
|
|
2672
2692
|
? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec
|
|
2673
2693
|
: this.uint32(value);
|
|
2674
2694
|
};
|
|
@@ -2683,16 +2703,18 @@ Writer.prototype.sint32 = function write_sint32(value) {
|
|
|
2683
2703
|
};
|
|
2684
2704
|
|
|
2685
2705
|
function writeVarint64(val, buf, pos) {
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2706
|
+
var lo = val.lo,
|
|
2707
|
+
hi = val.hi;
|
|
2708
|
+
while (hi) {
|
|
2709
|
+
buf[pos++] = lo & 127 | 128;
|
|
2710
|
+
lo = (lo >>> 7 | hi << 25) >>> 0;
|
|
2711
|
+
hi >>>= 7;
|
|
2690
2712
|
}
|
|
2691
|
-
while (
|
|
2692
|
-
buf[pos++] =
|
|
2693
|
-
|
|
2713
|
+
while (lo > 127) {
|
|
2714
|
+
buf[pos++] = lo & 127 | 128;
|
|
2715
|
+
lo = lo >>> 7;
|
|
2694
2716
|
}
|
|
2695
|
-
buf[pos++] =
|
|
2717
|
+
buf[pos++] = lo;
|
|
2696
2718
|
}
|
|
2697
2719
|
|
|
2698
2720
|
/**
|