Add production dependencies

This commit is contained in:
Jay Trees 2022-01-21 09:28:41 +01:00
parent 5a0114f3e2
commit 579ccdc29f
12113 changed files with 978046 additions and 3 deletions

33
node_modules/stream-exhaust/README.md generated vendored Normal file
View file

@ -0,0 +1,33 @@
# stream-exhaust
Ensure that the provided stream is flowing data, even if the stream hasn't been
piped to another stream.
```javascript
var exhaustively = require('stream-exhaust');
exhaustively(fs.createReadStream(__filename))
.on('close', () => { console.log('all done, despite being streams{1+N}!') });
```
## Prior Art
This is based on [stream-consume](https://github.com/aroneous/stream-consume)
by [aroneous](https://github.com/aroneous). It is a separate package because it has
different semantics:
1. It does not call `.resume()` on streams2+ streams. streams2 streams monkeypatch `.pipe`
when entering flowing mode; avoiding `resume()` avoids that fate.
2. It does not examine `._readableState`; instead it checks for the presence of `._read`.
## API
### exhaust(Stream s) -> Stream s
Takes a stream, `s`, and returns it. Ensures that the stream is flowing, either by calling
`.resume()` if the stream is a streams1 stream, or by piping it to a "black hole" stream that
continually asks for more data.
## License
MIT

34
node_modules/stream-exhaust/index.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
var Writable = require('stream').Writable;
var inherits = require('util').inherits;
module.exports = resumer;
function resumer(stream) {
if (!stream.readable) {
return stream;
}
if (stream._read) {
stream.pipe(new Sink);
return stream;
}
if (typeof stream.resume === 'function') {
stream.resume();
return stream;
}
return stream;
}
function Sink() {
Writable.call(this, {
objectMode: true
});
}
inherits(Sink, Writable);
Sink.prototype._write = function(chunk, encoding, cb) {
setImmediate(cb);
};

24
node_modules/stream-exhaust/package.json generated vendored Normal file
View file

@ -0,0 +1,24 @@
{
"name": "stream-exhaust",
"version": "1.0.2",
"description": "Ensure that a stream is flowing data without mutating it",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/chrisdickinson/stream-exhaust.git"
},
"author": "Chris Dickinson <chris@neversaw.us>",
"license": "MIT",
"bugs": {
"url": "https://github.com/chrisdickinson/stream-exhaust.git"
},
"homepage": "https://github.com/chrisdickinson/stream-exhaust.git",
"devDependencies": {
"readable-stream": "^1.0.31",
"tape": "^2.14.0",
"through2": "^0.5.1"
}
}

209
node_modules/stream-exhaust/test.js generated vendored Normal file
View file

@ -0,0 +1,209 @@
var test = require('tape');
var exhaust = require('./index.js');
var Stream = require('stream');
var Readable = Stream.Readable;
var Writable = Stream.Writable;
var Duplex = Stream.Duplex;
var through = require('through2');
var S2Readable = require('readable-stream').Readable;
test('it should cause a Readable stream to complete if it\'s not piped anywhere', function(assert) {
var rs = new Readable({highWaterMark: 2});
var a = 0;
var ended = false;
rs._read = function() {
if (a++ < 100) {
rs.push(a + "");
} else {
ended = true;
rs.push(null);
}
};
rs.on("end", function() {
assert.ok(a > 99, 'a should be > 99');
assert.ok(ended, 'it should end');
assert.end();
});
exhaust(rs);
});
test('should work with Readable streams in objectMode', function(assert) {
var rs = new Readable({highWaterMark: 2, objectMode: true});
var a = 0;
var ended = false;
rs._read = function() {
if (a++ < 100) {
rs.push(a);
} else {
ended = true;
rs.push(null);
}
};
rs.on("end", function() {
assert.ok(a > 99, 'a > 99');
assert.ok(ended, 'ended is true');
assert.end();
});
exhaust(rs);
});
test('should not interfere with a Readable stream that is piped somewhere', function(assert) {
var rs = new Readable({highWaterMark: 2});
var a = 0;
var ended = false;
rs._read = function() {
if (a++ < 100) {
rs.push(".");
} else {
ended = true;
rs.push(null);
}
};
var sizeRead = 0;
var ws = new Writable({highWaterMark: 2});
ws._write = function(chunk, enc, next) {
sizeRead += chunk.length;
next();
}
ws.on("finish", function() {
assert.ok(a > 99, 'a > 99');
assert.ok(ended, 'ended is true');
assert.equal(sizeRead, 100, 'sizeRead === 100');
assert.end();
});
rs.pipe(ws);
exhaust(rs);
});
test('should not interfere with a Writable stream', function(assert) {
var rs = new Readable({highWaterMark: 2});
var a = 0;
var ended = false;
rs._read = function() {
if (a++ < 100) {
rs.push(".");
} else {
ended = true;
rs.push(null);
}
};
var sizeRead = 0;
var ws = new Writable({highWaterMark: 2});
ws._write = function(chunk, enc, next) {
sizeRead += chunk.length;
next();
}
ws.on("finish", function() {
assert.ok(a > 99, 'a > 99');
assert.ok(ended, 'ended is true');
assert.equal(sizeRead, 100, 'sizeRead === 100');
assert.end();
});
rs.pipe(ws);
exhaust(ws);
});
test('should handle a Transform stream', function(assert) {
var rs = new Readable({highWaterMark: 2});
var a = 0;
var ended = false;
rs._read = function() {
if (a++ < 100) {
rs.push(".");
} else {
ended = true;
rs.push(null);
}
};
var sizeRead = 0;
var flushed = false;
var ts = through({highWaterMark: 2}, function(chunk, enc, cb) {
sizeRead += chunk.length;
this.push(chunk);
cb();
}, function(cb) {
flushed = true;
cb();
});
ts.on("end", function() {
assert.ok(a > 99, 'a > 99');
assert.ok(ended, 'ended is true');
assert.equal(sizeRead, 100, 'sizeRead === 100');
assert.ok(flushed, 'flushed is true');
assert.end();
});
rs.pipe(ts);
exhaust(ts);
});
test('should handle a classic stream', function(assert) {
var rs = new Stream();
var ended = false;
var i;
rs.on("end", function() {
assert.ok(ended, 'ended is true');
assert.end();
});
exhaust(rs);
for (i = 0; i < 100; i++) {
rs.emit("data", i);
}
ended = true;
rs.emit("end");
});
test('should not modify .pipe', function(assert) {
var stream = new S2Readable;
var pipe = stream.pipe;
stream._read = function() {
stream.push('ending');
stream.push(null);
};
exhaust(stream);
assert.equal(stream.pipe, pipe);
assert.end();
});
test('does not error on no resume but readable set to true', function(assert) {
var rs = new Stream();
rs.readable = true;
var ended = false;
var i;
rs.on("end", function() {
assert.ok(ended, 'ended is true');
assert.end();
});
exhaust(rs);
for (i = 0; i < 100; i++) {
rs.emit("data", i);
}
ended = true;
rs.emit("end");
});