protobufjs 7.2.5 → 7.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protobufjs",
3
- "version": "7.2.5",
3
+ "version": "7.3.0",
4
4
  "versionScheme": "~",
5
5
  "description": "Protocol Buffers for JavaScript (& TypeScript).",
6
6
  "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
package/src/parse.js CHANGED
@@ -144,7 +144,24 @@ function parse(source, root, options) {
144
144
  else
145
145
  target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]);
146
146
  } while (skip(",", true));
147
- skip(";");
147
+ var dummy = {options: undefined};
148
+ dummy.setOption = function(name, value) {
149
+ if (this.options === undefined) this.options = {};
150
+ this.options[name] = value;
151
+ };
152
+ ifBlock(
153
+ dummy,
154
+ function parseRange_block(token) {
155
+ /* istanbul ignore else */
156
+ if (token === "option") {
157
+ parseOption(dummy, token); // skip
158
+ skip(";");
159
+ } else
160
+ throw illegal(token);
161
+ },
162
+ function parseRange_line() {
163
+ parseInlineOptions(dummy); // skip
164
+ });
148
165
  }
149
166
 
150
167
  function parseNumber(token, insideTryCatch) {
package/src/root.js CHANGED
@@ -98,10 +98,10 @@ Root.prototype.load = function load(filename, options, callback) {
98
98
  /* istanbul ignore if */
99
99
  if (!callback)
100
100
  return;
101
- var cb = callback;
102
- callback = null;
103
101
  if (sync)
104
102
  throw err;
103
+ var cb = callback;
104
+ callback = null;
105
105
  cb(err, root);
106
106
  }
107
107