protobufjs 7.5.9 → 7.6.0
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 +1 -1
- package/dist/light/protobuf.js +8 -6
- 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 +2 -2
- package/dist/minimal/protobuf.min.js +2 -2
- package/dist/protobuf.js +8 -6
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/index.d.ts +2 -1
- package/package.json +2 -2
- package/src/converter.js +5 -3
- package/src/type.js +1 -1
package/index.d.ts
CHANGED
|
@@ -1779,7 +1779,7 @@ export interface IConversionOptions {
|
|
|
1779
1779
|
|
|
1780
1780
|
/**
|
|
1781
1781
|
* Long conversion type.
|
|
1782
|
-
* Valid values are `String` and `Number` (the global types).
|
|
1782
|
+
* Valid values are `BigInt`, `String` and `Number` (the global types).
|
|
1783
1783
|
* Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.
|
|
1784
1784
|
*/
|
|
1785
1785
|
longs?: Function;
|
|
@@ -2484,6 +2484,7 @@ export namespace util {
|
|
|
2484
2484
|
* Requires a module only if available.
|
|
2485
2485
|
* @param moduleName Module to require
|
|
2486
2486
|
* @returns Required module if available and not empty, otherwise `null`
|
|
2487
|
+
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
2487
2488
|
*/
|
|
2488
2489
|
function inquire(moduleName: string): object;
|
|
2489
2490
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "protobufjs",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"versionScheme": "~",
|
|
5
5
|
"description": "Protocol Buffers for JavaScript (& TypeScript).",
|
|
6
6
|
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@protobufjs/pool": "^1.1.0",
|
|
69
69
|
"@protobufjs/utf8": "^1.1.1",
|
|
70
70
|
"@types/node": ">=13.7.0",
|
|
71
|
-
"long": "^5.
|
|
71
|
+
"long": "^5.3.2"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"benchmark": "^2.1.4",
|
package/src/converter.js
CHANGED
|
@@ -187,7 +187,9 @@ function genValuePartial_toObject(gen, field, fieldIndex, prop) {
|
|
|
187
187
|
case "sint64":
|
|
188
188
|
case "fixed64":
|
|
189
189
|
case "sfixed64": gen
|
|
190
|
-
("if(typeof
|
|
190
|
+
("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
|
|
191
|
+
("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()", prop, prop, prop, prop, prop, isUnsigned)
|
|
192
|
+
("else if(typeof m%s===\"number\")", prop)
|
|
191
193
|
("d%s=o.longs===String?String(m%s):m%s", prop, prop, prop)
|
|
192
194
|
("else") // Long-like
|
|
193
195
|
("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop);
|
|
@@ -255,9 +257,9 @@ converter.toObject = function toObject(mtype) {
|
|
|
255
257
|
else if (field.long) gen
|
|
256
258
|
("if(util.Long){")
|
|
257
259
|
("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)
|
|
258
|
-
("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)
|
|
260
|
+
("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!==\"undefined\"&&o.longs===BigInt?n.toBigInt():n", prop)
|
|
259
261
|
("}else")
|
|
260
|
-
("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber());
|
|
262
|
+
("d%s=o.longs===String?%j:typeof BigInt!==\"undefined\"&&o.longs===BigInt?BigInt(%j):%i", prop, field.typeDefault.toString(), field.typeDefault.toString(), field.typeDefault.toNumber());
|
|
261
263
|
else if (field.bytes) {
|
|
262
264
|
var arrayDefault = Array.prototype.slice.call(field.typeDefault);
|
|
263
265
|
gen
|
package/src/type.js
CHANGED
|
@@ -580,7 +580,7 @@ Type.prototype.fromObject = function fromObject(object, depth) {
|
|
|
580
580
|
* Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.
|
|
581
581
|
* @interface IConversionOptions
|
|
582
582
|
* @property {Function} [longs] Long conversion type.
|
|
583
|
-
* Valid values are `String` and `Number` (the global types).
|
|
583
|
+
* Valid values are `BigInt`, `String` and `Number` (the global types).
|
|
584
584
|
* Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.
|
|
585
585
|
* @property {Function} [enums] Enum value conversion type.
|
|
586
586
|
* Only valid value is `String` (the global type).
|