protobufjs 6.11.3 → 7.1.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/README.md +7 -174
- package/dist/light/protobuf.js +77 -29
- 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 +27 -10
- 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 +163 -61
- 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 +9 -7
- package/package.json +12 -31
- package/scripts/postinstall.js +0 -3
- package/src/converter.js +12 -4
- package/src/decoder.js +4 -3
- package/src/enum.js +24 -7
- package/src/field.js +6 -3
- package/src/namespace.js +3 -3
- package/src/parse.js +55 -16
- package/src/roots.js +1 -1
- package/src/tokenize.js +31 -16
- package/src/util/minimal.js +24 -7
- package/src/wrappers.js +2 -2
- package/tsconfig.json +2 -1
- package/CHANGELOG.md +0 -1027
- package/bin/pbjs +0 -6
- package/bin/pbts +0 -6
- package/cli/LICENSE +0 -33
- package/cli/README.md +0 -174
- package/cli/bin/pbjs +0 -6
- package/cli/bin/pbts +0 -6
- package/cli/index.d.ts +0 -3
- package/cli/index.js +0 -3
- package/cli/lib/tsd-jsdoc/LICENSE +0 -21
- package/cli/lib/tsd-jsdoc/README.md +0 -23
- package/cli/lib/tsd-jsdoc/plugin.js +0 -21
- package/cli/lib/tsd-jsdoc/publish.js +0 -705
- package/cli/lib/tsd-jsdoc.json +0 -18
- package/cli/package.json +0 -8
- package/cli/package.standalone.json +0 -32
- package/cli/pbjs.d.ts +0 -9
- package/cli/pbjs.js +0 -330
- package/cli/pbts.d.ts +0 -9
- package/cli/pbts.js +0 -197
- package/cli/targets/json-module.js +0 -38
- package/cli/targets/json.js +0 -8
- package/cli/targets/proto.js +0 -326
- package/cli/targets/proto2.js +0 -10
- package/cli/targets/proto3.js +0 -10
- package/cli/targets/static-module.js +0 -29
- package/cli/targets/static.js +0 -711
- package/cli/util.js +0 -183
- package/cli/wrappers/amd.js +0 -7
- package/cli/wrappers/closure.js +0 -7
- package/cli/wrappers/commonjs.js +0 -7
- package/cli/wrappers/default.js +0 -15
- package/cli/wrappers/es6.js +0 -5
- package/dist/README.md +0 -31
- package/dist/light/README.md +0 -31
- package/dist/minimal/README.md +0 -31
- package/package-lock.json +0 -7870
- package/scripts/changelog.js +0 -150
package/dist/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v7.1.0 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled fri, 09 sep 2022 03:02:57 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -1535,8 +1535,14 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
1535
1535
|
if (field.resolvedType instanceof Enum) { gen
|
|
1536
1536
|
("switch(d%s){", prop);
|
|
1537
1537
|
for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
|
|
1538
|
-
|
|
1539
|
-
(
|
|
1538
|
+
// enum unknown values passthrough
|
|
1539
|
+
if (values[keys[i]] === field.typeDefault) { gen
|
|
1540
|
+
("default:")
|
|
1541
|
+
("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);
|
|
1542
|
+
if (!field.repeated) gen // fallback to default value only for
|
|
1543
|
+
// arrays, to avoid leaving holes.
|
|
1544
|
+
("break"); // for non-repeated fields, just ignore
|
|
1545
|
+
}
|
|
1540
1546
|
gen
|
|
1541
1547
|
("case%j:", keys[i])
|
|
1542
1548
|
("case %i:", values[keys[i]])
|
|
@@ -1583,7 +1589,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
1583
1589
|
case "bytes": gen
|
|
1584
1590
|
("if(typeof d%s===\"string\")", prop)
|
|
1585
1591
|
("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)
|
|
1586
|
-
("else if(d%s.length)", prop)
|
|
1592
|
+
("else if(d%s.length >= 0)", prop)
|
|
1587
1593
|
("m%s=d%s", prop, prop);
|
|
1588
1594
|
break;
|
|
1589
1595
|
case "string": gen
|
|
@@ -1668,7 +1674,7 @@ function genValuePartial_toObject(gen, field, fieldIndex, prop) {
|
|
|
1668
1674
|
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
1669
1675
|
if (field.resolvedType) {
|
|
1670
1676
|
if (field.resolvedType instanceof Enum) gen
|
|
1671
|
-
("d%s=o.enums===String?types[%i].values[m%s]:m%s", prop, fieldIndex, prop, prop);
|
|
1677
|
+
("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", prop, fieldIndex, prop, prop, fieldIndex, prop, prop);
|
|
1672
1678
|
else gen
|
|
1673
1679
|
("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);
|
|
1674
1680
|
} else {
|
|
@@ -1840,7 +1846,7 @@ function decoder(mtype) {
|
|
|
1840
1846
|
var field = mtype._fieldsArray[i].resolve(),
|
|
1841
1847
|
type = field.resolvedType instanceof Enum ? "int32" : field.type,
|
|
1842
1848
|
ref = "m" + util.safeProp(field.name); gen
|
|
1843
|
-
("case %i:", field.id);
|
|
1849
|
+
("case %i: {", field.id);
|
|
1844
1850
|
|
|
1845
1851
|
// Map fields
|
|
1846
1852
|
if (field.map) { gen
|
|
@@ -1911,8 +1917,9 @@ function decoder(mtype) {
|
|
|
1911
1917
|
else gen
|
|
1912
1918
|
("%s=r.%s()", ref, type);
|
|
1913
1919
|
gen
|
|
1914
|
-
("break")
|
|
1915
|
-
|
|
1920
|
+
("break")
|
|
1921
|
+
("}");
|
|
1922
|
+
// Unknown fields
|
|
1916
1923
|
} gen
|
|
1917
1924
|
("default:")
|
|
1918
1925
|
("r.skipType(t&7)")
|
|
@@ -2057,8 +2064,9 @@ var Namespace = require(23),
|
|
|
2057
2064
|
* @param {Object.<string,*>} [options] Declared options
|
|
2058
2065
|
* @param {string} [comment] The comment for this enum
|
|
2059
2066
|
* @param {Object.<string,string>} [comments] The value comments for this enum
|
|
2067
|
+
* @param {Object.<string,Object<string,*>>|undefined} [valuesOptions] The value options for this enum
|
|
2060
2068
|
*/
|
|
2061
|
-
function Enum(name, values, options, comment, comments) {
|
|
2069
|
+
function Enum(name, values, options, comment, comments, valuesOptions) {
|
|
2062
2070
|
ReflectionObject.call(this, name, options);
|
|
2063
2071
|
|
|
2064
2072
|
if (values && typeof values !== "object")
|
|
@@ -2088,6 +2096,12 @@ function Enum(name, values, options, comment, comments) {
|
|
|
2088
2096
|
*/
|
|
2089
2097
|
this.comments = comments || {};
|
|
2090
2098
|
|
|
2099
|
+
/**
|
|
2100
|
+
* Values options, if any
|
|
2101
|
+
* @type {Object<string, Object<string, *>>|undefined}
|
|
2102
|
+
*/
|
|
2103
|
+
this.valuesOptions = valuesOptions;
|
|
2104
|
+
|
|
2091
2105
|
/**
|
|
2092
2106
|
* Reserved ranges, if any.
|
|
2093
2107
|
* @type {Array.<number[]|string>}
|
|
@@ -2132,11 +2146,12 @@ Enum.fromJSON = function fromJSON(name, json) {
|
|
|
2132
2146
|
Enum.prototype.toJSON = function toJSON(toJSONOptions) {
|
|
2133
2147
|
var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
|
|
2134
2148
|
return util.toObject([
|
|
2135
|
-
"options"
|
|
2136
|
-
"
|
|
2137
|
-
"
|
|
2138
|
-
"
|
|
2139
|
-
"
|
|
2149
|
+
"options" , this.options,
|
|
2150
|
+
"valuesOptions" , this.valuesOptions,
|
|
2151
|
+
"values" , this.values,
|
|
2152
|
+
"reserved" , this.reserved && this.reserved.length ? this.reserved : undefined,
|
|
2153
|
+
"comment" , keepComments ? this.comment : undefined,
|
|
2154
|
+
"comments" , keepComments ? this.comments : undefined
|
|
2140
2155
|
]);
|
|
2141
2156
|
};
|
|
2142
2157
|
|
|
@@ -2145,11 +2160,12 @@ Enum.prototype.toJSON = function toJSON(toJSONOptions) {
|
|
|
2145
2160
|
* @param {string} name Value name
|
|
2146
2161
|
* @param {number} id Value id
|
|
2147
2162
|
* @param {string} [comment] Comment, if any
|
|
2163
|
+
* @param {Object.<string, *>|undefined} [options] Options, if any
|
|
2148
2164
|
* @returns {Enum} `this`
|
|
2149
2165
|
* @throws {TypeError} If arguments are invalid
|
|
2150
2166
|
* @throws {Error} If there is already a value with this name or id
|
|
2151
2167
|
*/
|
|
2152
|
-
Enum.prototype.add = function add(name, id, comment) {
|
|
2168
|
+
Enum.prototype.add = function add(name, id, comment, options) {
|
|
2153
2169
|
// utilized by the parser but not by .fromJSON
|
|
2154
2170
|
|
|
2155
2171
|
if (!util.isString(name))
|
|
@@ -2174,6 +2190,12 @@ Enum.prototype.add = function add(name, id, comment) {
|
|
|
2174
2190
|
} else
|
|
2175
2191
|
this.valuesById[this.values[name] = id] = name;
|
|
2176
2192
|
|
|
2193
|
+
if (options) {
|
|
2194
|
+
if (this.valuesOptions === undefined)
|
|
2195
|
+
this.valuesOptions = {};
|
|
2196
|
+
this.valuesOptions[name] = options || null;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2177
2199
|
this.comments[name] = comment || null;
|
|
2178
2200
|
return this;
|
|
2179
2201
|
};
|
|
@@ -2197,6 +2219,8 @@ Enum.prototype.remove = function remove(name) {
|
|
|
2197
2219
|
delete this.valuesById[val];
|
|
2198
2220
|
delete this.values[name];
|
|
2199
2221
|
delete this.comments[name];
|
|
2222
|
+
if (this.valuesOptions)
|
|
2223
|
+
delete this.valuesOptions[name];
|
|
2200
2224
|
|
|
2201
2225
|
return this;
|
|
2202
2226
|
};
|
|
@@ -2492,6 +2516,9 @@ Field.prototype.resolve = function resolve() {
|
|
|
2492
2516
|
this.typeDefault = null;
|
|
2493
2517
|
else // instanceof Enum
|
|
2494
2518
|
this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined
|
|
2519
|
+
} else if (this.options && this.options.proto3_optional) {
|
|
2520
|
+
// proto3 scalar value marked optional; should default to null
|
|
2521
|
+
this.typeDefault = null;
|
|
2495
2522
|
}
|
|
2496
2523
|
|
|
2497
2524
|
// use explicitly set default value if present
|
|
@@ -3192,7 +3219,8 @@ var ReflectionObject = require(24);
|
|
|
3192
3219
|
((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";
|
|
3193
3220
|
|
|
3194
3221
|
var Field = require(16),
|
|
3195
|
-
util = require(37)
|
|
3222
|
+
util = require(37),
|
|
3223
|
+
OneOf = require(25);
|
|
3196
3224
|
|
|
3197
3225
|
var Type, // cyclic
|
|
3198
3226
|
Service,
|
|
@@ -3403,7 +3431,7 @@ Namespace.prototype.getEnum = function getEnum(name) {
|
|
|
3403
3431
|
*/
|
|
3404
3432
|
Namespace.prototype.add = function add(object) {
|
|
3405
3433
|
|
|
3406
|
-
if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))
|
|
3434
|
+
if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace))
|
|
3407
3435
|
throw TypeError("object must be a valid nested object");
|
|
3408
3436
|
|
|
3409
3437
|
if (!this.nested)
|
|
@@ -3618,7 +3646,7 @@ Namespace._configure = function(Type_, Service_, Enum_) {
|
|
|
3618
3646
|
Enum = Enum_;
|
|
3619
3647
|
};
|
|
3620
3648
|
|
|
3621
|
-
},{"16":16,"24":24,"37":37}],24:[function(require,module,exports){
|
|
3649
|
+
},{"16":16,"24":24,"25":25,"37":37}],24:[function(require,module,exports){
|
|
3622
3650
|
"use strict";
|
|
3623
3651
|
module.exports = ReflectionObject;
|
|
3624
3652
|
|
|
@@ -4514,6 +4542,14 @@ function parse(source, root, options) {
|
|
|
4514
4542
|
}
|
|
4515
4543
|
break;
|
|
4516
4544
|
|
|
4545
|
+
case "message":
|
|
4546
|
+
parseType(type, token);
|
|
4547
|
+
break;
|
|
4548
|
+
|
|
4549
|
+
case "enum":
|
|
4550
|
+
parseEnum(type, token);
|
|
4551
|
+
break;
|
|
4552
|
+
|
|
4517
4553
|
/* istanbul ignore next */
|
|
4518
4554
|
default:
|
|
4519
4555
|
throw illegal(token); // there are no groups with proto3 semantics
|
|
@@ -4614,7 +4650,14 @@ function parse(source, root, options) {
|
|
|
4614
4650
|
|
|
4615
4651
|
skip("=");
|
|
4616
4652
|
var value = parseId(next(), true),
|
|
4617
|
-
dummy = {
|
|
4653
|
+
dummy = {
|
|
4654
|
+
options: undefined
|
|
4655
|
+
};
|
|
4656
|
+
dummy.setOption = function(name, value) {
|
|
4657
|
+
if (this.options === undefined)
|
|
4658
|
+
this.options = {};
|
|
4659
|
+
this.options[name] = value;
|
|
4660
|
+
};
|
|
4618
4661
|
ifBlock(dummy, function parseEnumValue_block(token) {
|
|
4619
4662
|
|
|
4620
4663
|
/* istanbul ignore else */
|
|
@@ -4627,7 +4670,7 @@ function parse(source, root, options) {
|
|
|
4627
4670
|
}, function parseEnumValue_line() {
|
|
4628
4671
|
parseInlineOptions(dummy); // skip
|
|
4629
4672
|
});
|
|
4630
|
-
parent.add(token, value, dummy.comment);
|
|
4673
|
+
parent.add(token, value, dummy.comment, dummy.options);
|
|
4631
4674
|
}
|
|
4632
4675
|
|
|
4633
4676
|
function parseOption(parent, token) {
|
|
@@ -4647,7 +4690,7 @@ function parse(source, root, options) {
|
|
|
4647
4690
|
option = name;
|
|
4648
4691
|
token = peek();
|
|
4649
4692
|
if (fqTypeRefRe.test(token)) {
|
|
4650
|
-
propName = token.
|
|
4693
|
+
propName = token.slice(1); //remove '.' before property name
|
|
4651
4694
|
name += token;
|
|
4652
4695
|
next();
|
|
4653
4696
|
}
|
|
@@ -4658,33 +4701,57 @@ function parse(source, root, options) {
|
|
|
4658
4701
|
}
|
|
4659
4702
|
|
|
4660
4703
|
function parseOptionValue(parent, name) {
|
|
4661
|
-
|
|
4662
|
-
|
|
4704
|
+
// { a: "foo" b { c: "bar" } }
|
|
4705
|
+
if (skip("{", true)) {
|
|
4706
|
+
var objectResult = {};
|
|
4707
|
+
|
|
4663
4708
|
while (!skip("}", true)) {
|
|
4664
4709
|
/* istanbul ignore if */
|
|
4665
|
-
if (!nameRe.test(token = next()))
|
|
4710
|
+
if (!nameRe.test(token = next())) {
|
|
4666
4711
|
throw illegal(token, "name");
|
|
4712
|
+
}
|
|
4667
4713
|
|
|
4668
4714
|
var value;
|
|
4669
4715
|
var propName = token;
|
|
4716
|
+
|
|
4717
|
+
skip(":", true);
|
|
4718
|
+
|
|
4670
4719
|
if (peek() === "{")
|
|
4671
4720
|
value = parseOptionValue(parent, name + "." + token);
|
|
4672
|
-
else {
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4721
|
+
else if (peek() === "[") {
|
|
4722
|
+
// option (my_option) = {
|
|
4723
|
+
// repeated_value: [ "foo", "bar" ]
|
|
4724
|
+
// };
|
|
4725
|
+
value = [];
|
|
4726
|
+
var lastValue;
|
|
4727
|
+
if (skip("[", true)) {
|
|
4728
|
+
do {
|
|
4729
|
+
lastValue = readValue(true);
|
|
4730
|
+
value.push(lastValue);
|
|
4731
|
+
} while (skip(",", true));
|
|
4732
|
+
skip("]");
|
|
4733
|
+
if (typeof lastValue !== "undefined") {
|
|
4734
|
+
setOption(parent, name + "." + token, lastValue);
|
|
4735
|
+
}
|
|
4679
4736
|
}
|
|
4737
|
+
} else {
|
|
4738
|
+
value = readValue(true);
|
|
4739
|
+
setOption(parent, name + "." + token, value);
|
|
4680
4740
|
}
|
|
4681
|
-
|
|
4741
|
+
|
|
4742
|
+
var prevValue = objectResult[propName];
|
|
4743
|
+
|
|
4682
4744
|
if (prevValue)
|
|
4683
4745
|
value = [].concat(prevValue).concat(value);
|
|
4684
|
-
|
|
4746
|
+
|
|
4747
|
+
objectResult[propName] = value;
|
|
4748
|
+
|
|
4749
|
+
// Semicolons and commas can be optional
|
|
4685
4750
|
skip(",", true);
|
|
4751
|
+
skip(";", true);
|
|
4686
4752
|
}
|
|
4687
|
-
|
|
4753
|
+
|
|
4754
|
+
return objectResult;
|
|
4688
4755
|
}
|
|
4689
4756
|
|
|
4690
4757
|
var simpleValue = readValue(true);
|
|
@@ -5728,7 +5795,7 @@ module.exports = {};
|
|
|
5728
5795
|
/**
|
|
5729
5796
|
* Named roots.
|
|
5730
5797
|
* This is where pbjs stores generated structures (the option `-r, --root` specifies a name).
|
|
5731
|
-
* Can also be used manually to make roots available
|
|
5798
|
+
* Can also be used manually to make roots available across modules.
|
|
5732
5799
|
* @name roots
|
|
5733
5800
|
* @type {Object.<string,Root>}
|
|
5734
5801
|
* @example
|
|
@@ -6198,11 +6265,8 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6198
6265
|
var offset = 0,
|
|
6199
6266
|
length = source.length,
|
|
6200
6267
|
line = 1,
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
commentLine = 0,
|
|
6204
|
-
commentLineEmpty = false,
|
|
6205
|
-
commentIsLeading = false;
|
|
6268
|
+
lastCommentLine = 0,
|
|
6269
|
+
comments = {};
|
|
6206
6270
|
|
|
6207
6271
|
var stack = [];
|
|
6208
6272
|
|
|
@@ -6255,10 +6319,11 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6255
6319
|
* @inner
|
|
6256
6320
|
*/
|
|
6257
6321
|
function setComment(start, end, isLeading) {
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6322
|
+
var comment = {
|
|
6323
|
+
type: source.charAt(start++),
|
|
6324
|
+
lineEmpty: false,
|
|
6325
|
+
leading: isLeading,
|
|
6326
|
+
};
|
|
6262
6327
|
var lookback;
|
|
6263
6328
|
if (alternateCommentMode) {
|
|
6264
6329
|
lookback = 2; // alternate comment parsing: "//" or "/*"
|
|
@@ -6270,7 +6335,7 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6270
6335
|
do {
|
|
6271
6336
|
if (--commentOffset < 0 ||
|
|
6272
6337
|
(c = source.charAt(commentOffset)) === "\n") {
|
|
6273
|
-
|
|
6338
|
+
comment.lineEmpty = true;
|
|
6274
6339
|
break;
|
|
6275
6340
|
}
|
|
6276
6341
|
} while (c === " " || c === "\t");
|
|
@@ -6281,9 +6346,12 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6281
6346
|
lines[i] = lines[i]
|
|
6282
6347
|
.replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "")
|
|
6283
6348
|
.trim();
|
|
6284
|
-
|
|
6349
|
+
comment.text = lines
|
|
6285
6350
|
.join("\n")
|
|
6286
6351
|
.trim();
|
|
6352
|
+
|
|
6353
|
+
comments[line] = comment;
|
|
6354
|
+
lastCommentLine = line;
|
|
6287
6355
|
}
|
|
6288
6356
|
|
|
6289
6357
|
function isDoubleSlashCommentLine(startOffset) {
|
|
@@ -6352,6 +6420,9 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6352
6420
|
++offset;
|
|
6353
6421
|
if (isDoc) {
|
|
6354
6422
|
setComment(start, offset - 1, isLeadingComment);
|
|
6423
|
+
// Trailing comment cannot not be multi-line,
|
|
6424
|
+
// so leading comment state should be reset to handle potential next comments
|
|
6425
|
+
isLeadingComment = true;
|
|
6355
6426
|
}
|
|
6356
6427
|
++line;
|
|
6357
6428
|
repeat = true;
|
|
@@ -6367,12 +6438,17 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6367
6438
|
break;
|
|
6368
6439
|
}
|
|
6369
6440
|
offset++;
|
|
6441
|
+
if (!isLeadingComment) {
|
|
6442
|
+
// Trailing comment cannot not be multi-line
|
|
6443
|
+
break;
|
|
6444
|
+
}
|
|
6370
6445
|
} while (isDoubleSlashCommentLine(offset));
|
|
6371
6446
|
} else {
|
|
6372
6447
|
offset = Math.min(length, findEndOfLine(offset) + 1);
|
|
6373
6448
|
}
|
|
6374
6449
|
if (isDoc) {
|
|
6375
6450
|
setComment(start, offset, isLeadingComment);
|
|
6451
|
+
isLeadingComment = true;
|
|
6376
6452
|
}
|
|
6377
6453
|
line++;
|
|
6378
6454
|
repeat = true;
|
|
@@ -6394,6 +6470,7 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6394
6470
|
++offset;
|
|
6395
6471
|
if (isDoc) {
|
|
6396
6472
|
setComment(start, offset - 2, isLeadingComment);
|
|
6473
|
+
isLeadingComment = true;
|
|
6397
6474
|
}
|
|
6398
6475
|
repeat = true;
|
|
6399
6476
|
} else {
|
|
@@ -6469,17 +6546,22 @@ function tokenize(source, alternateCommentMode) {
|
|
|
6469
6546
|
*/
|
|
6470
6547
|
function cmnt(trailingLine) {
|
|
6471
6548
|
var ret = null;
|
|
6549
|
+
var comment;
|
|
6472
6550
|
if (trailingLine === undefined) {
|
|
6473
|
-
|
|
6474
|
-
|
|
6551
|
+
comment = comments[line - 1];
|
|
6552
|
+
delete comments[line - 1];
|
|
6553
|
+
if (comment && (alternateCommentMode || comment.type === "*" || comment.lineEmpty)) {
|
|
6554
|
+
ret = comment.leading ? comment.text : null;
|
|
6475
6555
|
}
|
|
6476
6556
|
} else {
|
|
6477
6557
|
/* istanbul ignore else */
|
|
6478
|
-
if (
|
|
6558
|
+
if (lastCommentLine < trailingLine) {
|
|
6479
6559
|
peek();
|
|
6480
6560
|
}
|
|
6481
|
-
|
|
6482
|
-
|
|
6561
|
+
comment = comments[trailingLine];
|
|
6562
|
+
delete comments[trailingLine];
|
|
6563
|
+
if (comment && !comment.lineEmpty && (alternateCommentMode || comment.type === "/")) {
|
|
6564
|
+
ret = comment.leading ? null : comment.text;
|
|
6483
6565
|
}
|
|
6484
6566
|
}
|
|
6485
6567
|
return ret;
|
|
@@ -7465,6 +7547,9 @@ util.decorateEnum = function decorateEnum(object) {
|
|
|
7465
7547
|
util.setProperty = function setProperty(dst, path, value) {
|
|
7466
7548
|
function setProp(dst, path, value) {
|
|
7467
7549
|
var part = path.shift();
|
|
7550
|
+
if (part === "__proto__") {
|
|
7551
|
+
return dst;
|
|
7552
|
+
}
|
|
7468
7553
|
if (path.length > 0) {
|
|
7469
7554
|
dst[part] = setProp(dst[part] || {}, path, value);
|
|
7470
7555
|
} else {
|
|
@@ -7982,13 +8067,30 @@ function newError(name) {
|
|
|
7982
8067
|
merge(this, properties);
|
|
7983
8068
|
}
|
|
7984
8069
|
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
8070
|
+
CustomError.prototype = Object.create(Error.prototype, {
|
|
8071
|
+
constructor: {
|
|
8072
|
+
value: CustomError,
|
|
8073
|
+
writable: true,
|
|
8074
|
+
enumerable: false,
|
|
8075
|
+
configurable: true,
|
|
8076
|
+
},
|
|
8077
|
+
name: {
|
|
8078
|
+
get() { return name; },
|
|
8079
|
+
set: undefined,
|
|
8080
|
+
enumerable: false,
|
|
8081
|
+
// configurable: false would accurately preserve the behavior of
|
|
8082
|
+
// the original, but I'm guessing that was not intentional.
|
|
8083
|
+
// For an actual error subclass, this property would
|
|
8084
|
+
// be configurable.
|
|
8085
|
+
configurable: true,
|
|
8086
|
+
},
|
|
8087
|
+
toString: {
|
|
8088
|
+
value() { return this.name + ": " + this.message; },
|
|
8089
|
+
writable: true,
|
|
8090
|
+
enumerable: false,
|
|
8091
|
+
configurable: true,
|
|
8092
|
+
},
|
|
8093
|
+
});
|
|
7992
8094
|
|
|
7993
8095
|
return CustomError;
|
|
7994
8096
|
}
|
|
@@ -8352,7 +8454,7 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
8352
8454
|
if (type) {
|
|
8353
8455
|
// type_url does not accept leading "."
|
|
8354
8456
|
var type_url = object["@type"].charAt(0) === "." ?
|
|
8355
|
-
object["@type"].
|
|
8457
|
+
object["@type"].slice(1) : object["@type"];
|
|
8356
8458
|
// type_url prefix is optional, but path seperator is required
|
|
8357
8459
|
if (type_url.indexOf("/") === -1) {
|
|
8358
8460
|
type_url = "/" + type_url;
|
|
@@ -8390,7 +8492,7 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
8390
8492
|
if (!(message instanceof this.ctor) && message instanceof Message) {
|
|
8391
8493
|
var object = message.$type.toObject(message, options);
|
|
8392
8494
|
var messageName = message.$type.fullName[0] === "." ?
|
|
8393
|
-
message.$type.fullName.
|
|
8495
|
+
message.$type.fullName.slice(1) : message.$type.fullName;
|
|
8394
8496
|
// Default to type.googleapis.com prefix if no prefix is used
|
|
8395
8497
|
if (prefix === "") {
|
|
8396
8498
|
prefix = googleApi;
|