protobufjs 7.1.2 → 7.2.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
3
- * compiled thu, 22 sep 2022 17:16:10 utc
2
+ * protobuf.js v7.2.1 (c) 2016, daniel wirtz
3
+ * compiled thu, 02 feb 2023 21:27:33 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -1129,18 +1129,20 @@ var Enum = require(14),
1129
1129
  * @ignore
1130
1130
  */
1131
1131
  function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
1132
+ var defaultAlreadyEmitted = false;
1132
1133
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
1133
1134
  if (field.resolvedType) {
1134
1135
  if (field.resolvedType instanceof Enum) { gen
1135
1136
  ("switch(d%s){", prop);
1136
1137
  for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
1137
1138
  // enum unknown values passthrough
1138
- if (values[keys[i]] === field.typeDefault) { gen
1139
+ if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen
1139
1140
  ("default:")
1140
1141
  ("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);
1141
1142
  if (!field.repeated) gen // fallback to default value only for
1142
1143
  // arrays, to avoid leaving holes.
1143
1144
  ("break"); // for non-repeated fields, just ignore
1145
+ defaultAlreadyEmitted = true;
1144
1146
  }
1145
1147
  gen
1146
1148
  ("case%j:", keys[i])
@@ -4294,6 +4296,7 @@ Root.prototype.load = function load(filename, options, callback) {
4294
4296
 
4295
4297
  // Fetches a single file
4296
4298
  function fetch(filename, weak) {
4299
+ filename = getBundledFileName(filename) || filename;
4297
4300
 
4298
4301
  // Skip if already loaded / attempted
4299
4302
  if (self.files.indexOf(filename) > -1)
@@ -6378,7 +6381,7 @@ function newError(name) {
6378
6381
  configurable: true,
6379
6382
  },
6380
6383
  name: {
6381
- get() { return name; },
6384
+ get: function get() { return name; },
6382
6385
  set: undefined,
6383
6386
  enumerable: false,
6384
6387
  // configurable: false would accurately preserve the behavior of
@@ -6388,7 +6391,7 @@ function newError(name) {
6388
6391
  configurable: true,
6389
6392
  },
6390
6393
  toString: {
6391
- value() { return this.name + ": " + this.message; },
6394
+ value: function value() { return this.name + ": " + this.message; },
6392
6395
  writable: true,
6393
6396
  enumerable: false,
6394
6397
  configurable: true,