Skip to content

Commit

Permalink
➕ Add dependency on inherits
Browse files Browse the repository at this point in the history
At the moment, running `Backend` in the browser requires a polyfill of
the entire `util` built-in, when we only use `inherits`.

This change adds a dependency on `inherits`, which [uses][1] the Node.js
built-in if available, otherwise [falls back][2] to a browser-compatible
polyfill.

This allows downstream consumers avoiding having to polyfill `util`.

[1]: https://github.com/isaacs/inherits/blob/1286b65f07a03953d3857bf3dd1d77e8beede704/inherits.js#L5
[2]: https://github.com/isaacs/inherits/blob/1286b65f07a03953d3857bf3dd1d77e8beede704/inherits.js#L8
  • Loading branch information
alecgibson committed Mar 28, 2024
1 parent 5259d0e commit 468aeff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/op-stream.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var inherits = require('util').inherits;
var inherits = require('inherits');
var Readable = require('stream').Readable;
var util = require('./util');

Expand Down
2 changes: 1 addition & 1 deletion lib/stream-socket.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var Duplex = require('stream').Duplex;
var inherits = require('util').inherits;
var inherits = require('inherits');
var logger = require('./logger');
var util = require('./util');

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"async": "^3.2.4",
"fast-deep-equal": "^3.1.3",
"hat": "0.0.3",
"inherits": "^2.0.4",
"ot-json0": "^1.1.0"
},
"devDependencies": {
Expand Down

0 comments on commit 468aeff

Please sign in to comment.