protobufjs 8.0.0-experimental → 8.0.1-experimental
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 +26 -16
- 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 +48 -32
- 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 +0 -3
- package/package.json +1 -1
- package/src/index-light.js +1 -1
- package/src/object.js +20 -13
- package/src/parse.js +22 -16
- package/src/root.js +3 -0
package/dist/light/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v8.0.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v8.0.1-experimental (c) 2016, daniel wirtz
|
|
3
|
+
* compiled mon, 24 mar 2025 19:22:52 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -2420,7 +2420,7 @@ protobuf.types = require(32);
|
|
|
2420
2420
|
protobuf.util = require(33);
|
|
2421
2421
|
|
|
2422
2422
|
// Set up possibly cyclic reflection dependencies
|
|
2423
|
-
protobuf.ReflectionObject._configure(protobuf.Root);
|
|
2423
|
+
protobuf.ReflectionObject._configure(protobuf.Root, protobuf.Namespace);
|
|
2424
2424
|
protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
|
|
2425
2425
|
protobuf.Root._configure(protobuf.Type);
|
|
2426
2426
|
protobuf.Field._configure(protobuf.Type);
|
|
@@ -3338,7 +3338,7 @@ ReflectionObject.className = "ReflectionObject";
|
|
|
3338
3338
|
const OneOf = require(23);
|
|
3339
3339
|
var util = require(33);
|
|
3340
3340
|
|
|
3341
|
-
var Root; // cyclic
|
|
3341
|
+
var Root, Namespace; // cyclic
|
|
3342
3342
|
|
|
3343
3343
|
/* eslint-disable no-warning-comments */
|
|
3344
3344
|
// TODO: Replace with embedded proto.
|
|
@@ -3495,7 +3495,8 @@ ReflectionObject.prototype.onRemove = function onRemove(parent) {
|
|
|
3495
3495
|
ReflectionObject.prototype.resolve = function resolve() {
|
|
3496
3496
|
if (this.resolved)
|
|
3497
3497
|
return this;
|
|
3498
|
-
|
|
3498
|
+
var edition = this.getOption("edition");
|
|
3499
|
+
if ((this instanceof Namespace && edition) || (this.parent && this.parent.resolved)) {
|
|
3499
3500
|
this._resolveFeatures();
|
|
3500
3501
|
this.resolved = true;
|
|
3501
3502
|
}
|
|
@@ -3509,24 +3510,27 @@ ReflectionObject.prototype.resolve = function resolve() {
|
|
|
3509
3510
|
ReflectionObject.prototype._resolveFeatures = function _resolveFeatures() {
|
|
3510
3511
|
var defaults = {};
|
|
3511
3512
|
|
|
3512
|
-
var
|
|
3513
|
-
|
|
3514
|
-
|
|
3513
|
+
var protoFeatures = Object.assign(Object.assign({}, this._protoFeatures), this._inferLegacyProtoFeatures(edition));
|
|
3514
|
+
|
|
3515
|
+
var edition = this.getOption("edition");
|
|
3516
|
+
if (this instanceof Namespace && edition) {
|
|
3517
|
+
// For a namespace marked with a specific edition, reset defaults.
|
|
3518
|
+
if (edition === "proto2") {
|
|
3519
|
+
defaults = Object.assign({}, proto2Defaults);
|
|
3520
|
+
} else if (edition === "proto3") {
|
|
3515
3521
|
defaults = Object.assign({}, proto3Defaults);
|
|
3516
3522
|
} else if (edition === "2023") {
|
|
3517
3523
|
defaults = Object.assign({}, editions2023Defaults);
|
|
3518
3524
|
} else {
|
|
3519
|
-
|
|
3525
|
+
throw new Error("Unknown edition: " + edition);
|
|
3520
3526
|
}
|
|
3527
|
+
this._features = Object.assign(defaults, protoFeatures || {});
|
|
3528
|
+
return;
|
|
3521
3529
|
}
|
|
3522
3530
|
|
|
3523
|
-
var protoFeatures = Object.assign(Object.assign({}, this._protoFeatures), this._inferLegacyProtoFeatures(edition));
|
|
3524
|
-
|
|
3525
|
-
if (this instanceof Root) {
|
|
3526
|
-
this._features = Object.assign(defaults, protoFeatures || {});
|
|
3527
3531
|
// fields in Oneofs aren't actually children of them, so we have to
|
|
3528
3532
|
// special-case it
|
|
3529
|
-
|
|
3533
|
+
if (this.partOf instanceof OneOf) {
|
|
3530
3534
|
var lexicalParentFeaturesCopy = Object.assign({}, this.partOf._features);
|
|
3531
3535
|
this._features = Object.assign(lexicalParentFeaturesCopy, protoFeatures || {});
|
|
3532
3536
|
} else if (this.declaringField) {
|
|
@@ -3573,8 +3577,10 @@ ReflectionObject.prototype.getOption = function getOption(name) {
|
|
|
3573
3577
|
* @returns {ReflectionObject} `this`
|
|
3574
3578
|
*/
|
|
3575
3579
|
ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {
|
|
3576
|
-
if (!ifNotSet || !this.options || this.options[name] === undefined)
|
|
3580
|
+
if (!ifNotSet || !this.options || this.options[name] === undefined) {
|
|
3581
|
+
if (this.getOption(name) !== value) this.resolved = false;
|
|
3577
3582
|
(this.options || (this.options = {}))[name] = value;
|
|
3583
|
+
}
|
|
3578
3584
|
return this;
|
|
3579
3585
|
};
|
|
3580
3586
|
|
|
@@ -3650,8 +3656,9 @@ ReflectionObject.prototype.toString = function toString() {
|
|
|
3650
3656
|
};
|
|
3651
3657
|
|
|
3652
3658
|
// Sets up cyclic dependencies (called in index-light)
|
|
3653
|
-
ReflectionObject._configure = function(Root_) {
|
|
3659
|
+
ReflectionObject._configure = function(Root_, Namespace_) {
|
|
3654
3660
|
Root = Root_;
|
|
3661
|
+
Namespace = Namespace_;
|
|
3655
3662
|
};
|
|
3656
3663
|
|
|
3657
3664
|
},{"23":23,"33":33}],23:[function(require,module,exports){
|
|
@@ -4387,6 +4394,9 @@ function Root(options) {
|
|
|
4387
4394
|
* @type {string[]}
|
|
4388
4395
|
*/
|
|
4389
4396
|
this.files = [];
|
|
4397
|
+
|
|
4398
|
+
// Default to proto2 if not specified.
|
|
4399
|
+
this.setOption("edition", "proto2", true);
|
|
4390
4400
|
}
|
|
4391
4401
|
|
|
4392
4402
|
/**
|