protobufjs 7.1.1 → 7.2.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 CHANGED
@@ -65,16 +65,16 @@ $> npm install protobufjs-cli [--save --save-prefix=~]
65
65
  Development:
66
66
 
67
67
  ```
68
- <script src="//cdn.rawgit.com/dcodeIO/protobuf.js/6.X.X/dist/protobuf.js"></script>
68
+ <script src="//cdn.jsdelivr.net/npm/protobufjs@7.X.X/dist/protobuf.js"></script>
69
69
  ```
70
70
 
71
71
  Production:
72
72
 
73
73
  ```
74
- <script src="//cdn.rawgit.com/dcodeIO/protobuf.js/6.X.X/dist/protobuf.min.js"></script>
74
+ <script src="//cdn.jsdelivr.net/npm/protobufjs@7.X.X/dist/protobuf.min.js"></script>
75
75
  ```
76
76
 
77
- **Remember** to replace the version tag with the exact [release](https://github.com/dcodeIO/protobuf.js/tags) your project depends upon.
77
+ **Remember** to replace the version tag with the exact [release](https://github.com/protobufjs/protobuf.js/tags) your project depends upon.
78
78
 
79
79
  The library supports CommonJS and AMD loaders and also exports globally as `protobuf`.
80
80
 
@@ -94,9 +94,11 @@ Where bundle size is a factor, there are additional stripped-down versions of th
94
94
  var protobuf = require("protobufjs/minimal");
95
95
  ```
96
96
 
97
- [dist-full]: https://github.com/dcodeIO/protobuf.js/tree/master/dist
98
- [dist-light]: https://github.com/dcodeIO/protobuf.js/tree/master/dist/light
99
- [dist-minimal]: https://github.com/dcodeIO/protobuf.js/tree/master/dist/minimal
97
+ | Distribution | Location
98
+ |------------|-----------------------------------
99
+ | Full | <https://cdn.jsdelivr.net/npm/protobufjs/dist/>
100
+ | Light | <https://cdn.jsdelivr.net/npm/protobufjs/dist/light/>
101
+ | Minimal | <https://cdn.jsdelivr.net/npm/protobufjs/dist/minimal/>
100
102
 
101
103
  Usage
102
104
  -----
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
3
- * compiled fri, 09 sep 2022 03:02:57 utc
2
+ * protobuf.js v7.2.0 (c) 2016, daniel wirtz
3
+ * compiled tue, 24 jan 2023 20:12:01 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])
@@ -2941,9 +2943,8 @@ Object.defineProperty(Namespace.prototype, "nestedArray", {
2941
2943
  /**
2942
2944
  * Any nested object descriptor.
2943
2945
  * @typedef AnyNestedObject
2944
- * @type {IEnum|IType|IService|AnyExtensionField|INamespace}
2946
+ * @type {IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf}
2945
2947
  */
2946
- // ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)
2947
2948
 
2948
2949
  /**
2949
2950
  * Converts this namespace to a namespace descriptor.
@@ -4248,10 +4249,10 @@ Root.prototype.load = function load(filename, options, callback) {
4248
4249
  /* istanbul ignore if */
4249
4250
  if (!callback)
4250
4251
  return;
4251
- var cb = callback;
4252
- callback = null;
4253
4252
  if (sync)
4254
4253
  throw err;
4254
+ var cb = callback;
4255
+ callback = null;
4255
4256
  cb(err, root);
4256
4257
  }
4257
4258