Created
July 4, 2021 00:12
-
-
Save m00nwtchr/84a1233ddc9ee098ba443359a7e0f8ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/node_modules/readable-stream/lib/_registry.js b/node_modules/readable-stream/lib/_registry.js | |
| new file mode 100644 | |
| index 0000000..7c6d6c7 | |
| --- /dev/null | |
| +++ b/node_modules/readable-stream/lib/_registry.js | |
| @@ -0,0 +1 @@ | |
| +module.exports = {} | |
| \ No newline at end of file | |
| diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js | |
| index 6752519..5649247 100644 | |
| --- a/node_modules/readable-stream/lib/_stream_duplex.js | |
| +++ b/node_modules/readable-stream/lib/_stream_duplex.js | |
| @@ -36,29 +36,26 @@ var objectKeys = Object.keys || function (obj) { | |
| }; | |
| /*</replacement>*/ | |
| +const Registry = require('./_registry'); | |
| -module.exports = Duplex; | |
| +Registry.Duplex = Duplex; | |
| -var Readable = require('./_stream_readable'); | |
| - | |
| -var Writable = require('./_stream_writable'); | |
| - | |
| -require('inherits')(Duplex, Readable); | |
| +require('inherits')(Duplex, Registry.Readable); | |
| { | |
| // Allow the keys array to be GC'ed. | |
| - var keys = objectKeys(Writable.prototype); | |
| + var keys = objectKeys(Registry.Writable.prototype); | |
| for (var v = 0; v < keys.length; v++) { | |
| var method = keys[v]; | |
| - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; | |
| + if (!Duplex.prototype[method]) Duplex.prototype[method] = Registry.Writable.prototype[method]; | |
| } | |
| } | |
| function Duplex(options) { | |
| if (!(this instanceof Duplex)) return new Duplex(options); | |
| - Readable.call(this, options); | |
| - Writable.call(this, options); | |
| + Registry.Readable.call(this, options); | |
| + Registry.Writable.call(this, options); | |
| this.allowHalfOpen = true; | |
| if (options) { | |
| diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js | |
| index 32e7414..f21ef38 100644 | |
| --- a/node_modules/readable-stream/lib/_stream_passthrough.js | |
| +++ b/node_modules/readable-stream/lib/_stream_passthrough.js | |
| @@ -23,11 +23,10 @@ | |
| // Every written chunk gets output as-is. | |
| 'use strict'; | |
| -module.exports = PassThrough; | |
| +const Registry = require('./_registry'); | |
| +Registry.PassThrough = PassThrough; | |
| -var Transform = require('./_stream_transform'); | |
| - | |
| -require('inherits')(PassThrough, Transform); | |
| +require('inherits')(PassThrough, Registry.Transform); | |
| function PassThrough(options) { | |
| if (!(this instanceof PassThrough)) return new PassThrough(options); | |
| diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js | |
| index 192d451..a1bc862 100644 | |
| --- a/node_modules/readable-stream/lib/_stream_readable.js | |
| +++ b/node_modules/readable-stream/lib/_stream_readable.js | |
| @@ -20,11 +20,9 @@ | |
| // USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 'use strict'; | |
| -module.exports = Readable; | |
| -/*<replacement>*/ | |
| -var Duplex; | |
| -/*</replacement>*/ | |
| +const Registry = require('./_registry'); | |
| +Registry.Readable = Readable; | |
| Readable.ReadableState = ReadableState; | |
| /*<replacement>*/ | |
| @@ -104,14 +102,13 @@ function prependListener(emitter, event, fn) { | |
| } | |
| function ReadableState(options, stream, isDuplex) { | |
| - Duplex = Duplex || require('./_stream_duplex'); | |
| options = options || {}; // Duplex streams are both readable and writable, but share | |
| // the same options object. | |
| // However, some cases require setting options to different | |
| // values for the readable and the writable sides of the duplex stream. | |
| // These options can be provided separately as readableXXX and writableXXX. | |
| - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to | |
| + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Registry.Duplex; // object stream flag. Used to make read(n) ignore n and to | |
| // make all the buffer merging and length checks go away | |
| this.objectMode = !!options.objectMode; | |
| @@ -167,11 +164,10 @@ function ReadableState(options, stream, isDuplex) { | |
| } | |
| function Readable(options) { | |
| - Duplex = Duplex || require('./_stream_duplex'); | |
| if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside | |
| // the ReadableState constructor, at least with V8 6.5 | |
| - var isDuplex = this instanceof Duplex; | |
| + var isDuplex = this instanceof Registry.Duplex; | |
| this._readableState = new ReadableState(options, this, isDuplex); // legacy | |
| this.readable = true; | |
| diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js | |
| index 41a738c..a391fda 100644 | |
| --- a/node_modules/readable-stream/lib/_stream_transform.js | |
| +++ b/node_modules/readable-stream/lib/_stream_transform.js | |
| @@ -61,7 +61,9 @@ | |
| // the results of the previous transformed chunk were consumed. | |
| 'use strict'; | |
| -module.exports = Transform; | |
| +const Registry = require('./_registry'); | |
| + | |
| +Registry.Transform = Transform; | |
| var _require$codes = require('../errors').codes, | |
| ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, | |
| @@ -69,9 +71,7 @@ var _require$codes = require('../errors').codes, | |
| ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, | |
| ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; | |
| -var Duplex = require('./_stream_duplex'); | |
| - | |
| -require('inherits')(Transform, Duplex); | |
| +require('inherits')(Transform, Registry.Duplex); | |
| function afterTransform(er, data) { | |
| var ts = this._transformState; | |
| @@ -97,7 +97,7 @@ function afterTransform(er, data) { | |
| function Transform(options) { | |
| if (!(this instanceof Transform)) return new Transform(options); | |
| - Duplex.call(this, options); | |
| + Registry.Duplex.call(this, options); | |
| this._transformState = { | |
| afterTransform: afterTransform.bind(this), | |
| needTransform: false, | |
| @@ -136,7 +136,7 @@ function prefinish() { | |
| Transform.prototype.push = function (chunk, encoding) { | |
| this._transformState.needTransform = false; | |
| - return Duplex.prototype.push.call(this, chunk, encoding); | |
| + return Registry.Duplex.prototype.push.call(this, chunk, encoding); | |
| }; // This is the part where you do stuff! | |
| // override this function in implementation classes. | |
| // 'chunk' is an input chunk. | |
| @@ -183,7 +183,7 @@ Transform.prototype._read = function (n) { | |
| }; | |
| Transform.prototype._destroy = function (err, cb) { | |
| - Duplex.prototype._destroy.call(this, err, function (err2) { | |
| + Registry.Duplex.prototype._destroy.call(this, err, function (err2) { | |
| cb(err2); | |
| }); | |
| }; | |
| diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js | |
| index a2634d7..3c40082 100644 | |
| --- a/node_modules/readable-stream/lib/_stream_writable.js | |
| +++ b/node_modules/readable-stream/lib/_stream_writable.js | |
| @@ -23,7 +23,9 @@ | |
| // the drain event emission and buffering. | |
| 'use strict'; | |
| -module.exports = Writable; | |
| +const Registry = require ('./_registry'); | |
| + | |
| +Registry.Writable = Writable; | |
| /* <replacement> */ | |
| function WriteReq(chunk, encoding, cb) { | |
| @@ -50,7 +52,6 @@ function CorkedRequest(state) { | |
| /*<replacement>*/ | |
| -var Duplex; | |
| /*</replacement>*/ | |
| Writable.WritableState = WritableState; | |
| @@ -101,14 +102,13 @@ require('inherits')(Writable, Stream); | |
| function nop() {} | |
| function WritableState(options, stream, isDuplex) { | |
| - Duplex = Duplex || require('./_stream_duplex'); | |
| options = options || {}; // Duplex streams are both readable and writable, but share | |
| // the same options object. | |
| // However, some cases require setting options to different | |
| // values for the readable and the writable sides of the duplex stream, | |
| // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. | |
| - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream | |
| + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Registry.Duplex; // object stream flag to indicate whether or not this stream | |
| // contains buffers or objects. | |
| this.objectMode = !!options.objectMode; | |
| @@ -227,7 +227,7 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot | |
| } | |
| function Writable(options) { | |
| - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. | |
| + // Writable ctor is applied to Duplexes, too. | |
| // `realHasInstance` is necessary because using plain `instanceof` | |
| // would return false, as no `_writableState` property is attached. | |
| // Trying to use the custom `instanceof` for Writable here will also break the | |
| @@ -236,7 +236,7 @@ function Writable(options) { | |
| // Checking for a Stream.Duplex instance is faster here instead of inside | |
| // the WritableState constructor, at least with V8 6.5 | |
| - var isDuplex = this instanceof Duplex; | |
| + var isDuplex = this instanceof Registry.Duplex; | |
| if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); | |
| this._writableState = new WritableState(options, this, isDuplex); // legacy. | |
| diff --git a/node_modules/readable-stream/readable-browser.js b/node_modules/readable-stream/readable-browser.js | |
| index adbf60d..5334748 100644 | |
| --- a/node_modules/readable-stream/readable-browser.js | |
| +++ b/node_modules/readable-stream/readable-browser.js | |
| @@ -1,9 +1,19 @@ | |
| -exports = module.exports = require('./lib/_stream_readable.js'); | |
| -exports.Stream = exports; | |
| -exports.Readable = exports; | |
| -exports.Writable = require('./lib/_stream_writable.js'); | |
| -exports.Duplex = require('./lib/_stream_duplex.js'); | |
| -exports.Transform = require('./lib/_stream_transform.js'); | |
| -exports.PassThrough = require('./lib/_stream_passthrough.js'); | |
| +const Registry = require('./lib/_registry.js'); | |
| + | |
| +require('./lib/_stream_readable.js'); | |
| +require('./lib/_stream_writable.js'); | |
| +require('./lib/_stream_duplex.js'); | |
| +require('./lib/_stream_transform.js'); | |
| +require('./lib/_stream_passthrough.js'); | |
| +require('./lib/_stream_passthrough.js'); | |
| + | |
| +exports = module.exports = Registry.Readable; | |
| + | |
| +exports.Stream = Registry.Readable; | |
| +exports.Readable = Registry.Readable; | |
| +exports.Writable = Registry.Writable; | |
| +exports.Duplex = Registry.Duplex; | |
| +exports.Transform = Registry.Transform; | |
| +exports.PassThrough = Registry.PassThrough; | |
| exports.finished = require('./lib/internal/streams/end-of-stream.js'); | |
| exports.pipeline = require('./lib/internal/streams/pipeline.js'); | |
| \ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment