protobufjs 7.5.8 → 7.5.9

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.5.8",
3
+ "version": "7.5.9",
4
4
  "versionScheme": "~",
5
5
  "description": "Protocol Buffers for JavaScript (& TypeScript).",
6
6
  "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
@@ -27,6 +27,9 @@
27
27
  ],
28
28
  "main": "index.js",
29
29
  "types": "index.d.ts",
30
+ "browser": {
31
+ "fs": false
32
+ },
30
33
  "publishConfig": {
31
34
  "tag": "latest-7"
32
35
  },
@@ -58,9 +61,9 @@
58
61
  "@protobufjs/base64": "^1.1.2",
59
62
  "@protobufjs/codegen": "^2.0.5",
60
63
  "@protobufjs/eventemitter": "^1.1.0",
61
- "@protobufjs/fetch": "^1.1.0",
64
+ "@protobufjs/fetch": "^1.1.1",
62
65
  "@protobufjs/float": "^1.0.2",
63
- "@protobufjs/inquire": "^1.1.1",
66
+ "@protobufjs/inquire": "^1.1.2",
64
67
  "@protobufjs/path": "^1.1.2",
65
68
  "@protobufjs/pool": "^1.1.0",
66
69
  "@protobufjs/utf8": "^1.1.1",
package/src/util/fs.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var fs = null;
4
+ try {
5
+ fs = require(/* webpackIgnore: true */ "fs");
6
+ if (!fs || !fs.readFile || !fs.readFileSync)
7
+ fs = null;
8
+ } catch (e) {
9
+ // `fs` is unavailable in browsers and browser-like bundles.
10
+ }
11
+ module.exports = fs;
@@ -125,7 +125,7 @@ util.isSet = function isSet(obj, prop) {
125
125
  */
126
126
  util.Buffer = (function() {
127
127
  try {
128
- var Buffer = util.inquire("buffer").Buffer;
128
+ var Buffer = util.global.Buffer;
129
129
  // refuse to use non-node buffers if not explicitly assigned (perf reasons):
130
130
  return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;
131
131
  } catch (e) {
@@ -179,7 +179,15 @@ util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore n
179
179
  */
180
180
  util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long
181
181
  || /* istanbul ignore next */ util.global.Long
182
- || util.inquire("long");
182
+ || (function() {
183
+ try {
184
+ var Long = require("long");
185
+ return Long && Long.isLong ? Long : null;
186
+ } catch (e) {
187
+ /* istanbul ignore next */
188
+ return null;
189
+ }
190
+ })();
183
191
 
184
192
  /**
185
193
  * Regular expression used to verify 2 bit (`bool`) map keys.
package/src/util.js CHANGED
@@ -23,7 +23,7 @@ var reservedRe = util.patterns.reservedRe,
23
23
  * Node's fs module if available.
24
24
  * @type {Object.<string,*>}
25
25
  */
26
- util.fs = util.inquire("fs");
26
+ util.fs = require("./util/fs");
27
27
 
28
28
  /**
29
29
  * Checks a recursion depth.