From 468aeffccae28a788ae2d0bd03c45794b53474cc Mon Sep 17 00:00:00 2001 From: Alec Gibson <12036746+alecgibson@users.noreply.github.com> Date: Thu, 28 Mar 2024 16:05:57 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20Add=20dependency=20on=20`inherits`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- lib/op-stream.js | 2 +- lib/stream-socket.js | 2 +- package.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/op-stream.js b/lib/op-stream.js index a2608fd28..782529fb0 100644 --- a/lib/op-stream.js +++ b/lib/op-stream.js @@ -1,4 +1,4 @@ -var inherits = require('util').inherits; +var inherits = require('inherits'); var Readable = require('stream').Readable; var util = require('./util'); diff --git a/lib/stream-socket.js b/lib/stream-socket.js index 057064c16..304a70340 100644 --- a/lib/stream-socket.js +++ b/lib/stream-socket.js @@ -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'); diff --git a/package.json b/package.json index 81d5f78a1..8f45adc1e 100644 --- a/package.json +++ b/package.json @@ -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": {