first commit

This commit is contained in:
2024-01-19 11:09:11 +01:00
commit b18af7a943
29473 changed files with 4500547 additions and 0 deletions

24
node_modules/@ljharb/through/.eslintrc generated vendored Normal file
View File

@@ -0,0 +1,24 @@
{
"root": true,
"extends": "@ljharb/eslint-config/node/0.4",
"rules": {
"consistent-return": "warn",
"func-style": "warn",
"max-lines-per-function": "off",
"max-statements-per-line": "warn",
"no-invalid-this": "warn",
"no-param-reassign": "warn",
"no-underscore-dangle": "warn",
},
"overrides": [
{
"files": "test/**",
"rules": {
"no-plusplus": "warn",
},
},
],
}

12
node_modules/@ljharb/through/.github/FUNDING.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/@ljharb/through
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with a single custom sponsorship URL

13
node_modules/@ljharb/through/.nycrc generated vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"lines": 86,
"statements": 85.93,
"functions": 82.43,
"branches": 76.06,
"exclude": [
"coverage",
"test"
]
}

250
node_modules/@ljharb/through/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,250 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.3.11](https://github.com/ljharb/through/compare/v2.3.10...v2.3.11) - 2023-10-11
### Commits
- [Deps] add missing `call-bind` [`da5e46d`](https://github.com/ljharb/through/commit/da5e46d31045e18b79dc137bbc2bde1ebf839b38)
## [v2.3.10](https://github.com/ljharb/through/compare/v2.3.9...v2.3.10) - 2023-10-10
### Commits
- [Robustness] use `call-bind` [`3fc8de1`](https://github.com/ljharb/through/commit/3fc8de1dd6b5c69ebca1b212d4852ca11e853cb2)
- [Dev Deps] update `aud`, `tape` [`db14fcf`](https://github.com/ljharb/through/commit/db14fcf1457d1e35b22856de42767d0bf4773fd8)
## [v2.3.9](https://github.com/ljharb/through/compare/v2.3.8...v2.3.9) - 2023-07-17
### Commits
- [meta] add scripts, dev deps, linting; switch from travis to GHA [`2bc7e2d`](https://github.com/ljharb/through/commit/2bc7e2d1f63caf9cbdd146c9d752d3f62f564405)
- [meta] rename package to scoped [`337610b`](https://github.com/ljharb/through/commit/337610b937196ad26abe40c7d191942c0d54f455)
- [meta] confirmed with dominictarr in writing that this package was only ever MIT [`832061e`](https://github.com/ljharb/through/commit/832061e15beb9643b74e16b1f8343c36620f5be7)
- [Dev Deps] update `from`, `stream-spec`, `tape` [`dae9dda`](https://github.com/ljharb/through/commit/dae9dda68c7df31960239957e7694de1f3bca40a)
- [meta] fix auto-changelog start version [`3ac451b`](https://github.com/ljharb/through/commit/3ac451b684d4b4cb9356eb758691e6438b0083d1)
- [Fix] `node < v0.6` does not have `stream` === `stream.Stream` [`9f72162`](https://github.com/ljharb/through/commit/9f721627f62dfa4dad1f5515f4d3d1aa3613ccb0)
<!-- auto-changelog-above -->
## [v2.3.8](https://github.com/ljharb/through/compare/v2.3.7...v2.3.8) - 2015-07-03
### Merged
- Update package.json [`#35`](https://github.com/dominictarr/through/pull/35)
## [v2.3.7](https://github.com/ljharb/through/compare/v2.3.6...v2.3.7) - 2015-04-06
### Commits
- fix non-strict null check [`7048350`](https://github.com/dominictarr/through/commit/7048350a5dae8bbbb3b9a972ecec4fe2460d113d)
## [v2.3.6](https://github.com/ljharb/through/compare/v2.3.5...v2.3.6) - 2014-09-16
### Commits
- simple async test [`a98561f`](https://github.com/dominictarr/through/commit/a98561fae17615da8fe6c9dc00208c5107bf9774)
- update test to work in the browser (without process.on("exit") [`7dabce0`](https://github.com/dominictarr/through/commit/7dabce06b4d367f280846a72fe468ace54d55456)
- remove concat-stream [`69d31f3`](https://github.com/dominictarr/through/commit/69d31f3efe1600a44787cb198d7b97ae7eaa7167)
- add dev deps [`d387710`](https://github.com/dominictarr/through/commit/d387710cccaeec66dc889377778c17254ea13ef4)
- validate before end [`c267d90`](https://github.com/dominictarr/through/commit/c267d90e3cdb501510edfd590245fd1d58fe29bd)
- use tape@2.3.2 [`1080f0c`](https://github.com/dominictarr/through/commit/1080f0ca8d32813cd50be9eac5975504fb5b8a55)
- testling badge [`aa23057`](https://github.com/dominictarr/through/commit/aa23057876709666ab4d02f0cd7a36797de77c80)
- tidy [`c5d9757`](https://github.com/dominictarr/through/commit/c5d9757c8c8e31d563dc4a4bbb02a5f7e6304360)
## [v2.3.5](https://github.com/ljharb/through/compare/v2.3.4...v2.3.5) - 2013-05-05
### Fixed
- fix spelling Closes #13 [`#13`](https://github.com/dominictarr/through/issues/13)
## [v2.3.4](https://github.com/ljharb/through/compare/v2.3.3...v2.3.4) - 2013-04-29
### Merged
- mark "write" method as code [`#14`](https://github.com/dominictarr/through/pull/14)
### Commits
- fix typo [`e94d772`](https://github.com/dominictarr/through/commit/e94d7726f765e4fcb83169ba845ebbb9fec418c7)
## [v2.3.3](https://github.com/ljharb/through/compare/v2.3.2...v2.3.3) - 2013-04-24
### Merged
- Test on 0.10 on Travis [`#12`](https://github.com/dominictarr/through/pull/12)
## [v2.3.2](https://github.com/ljharb/through/compare/v2.3.1...v2.3.2) - 2013-04-24
### Commits
- check that through ends exactly once [`802ecff`](https://github.com/dominictarr/through/commit/802ecff64d8462be9e1db6a578857393a37b19eb)
- emit "end" exactly once [`6f814a6`](https://github.com/dominictarr/through/commit/6f814a601b37db1f44113e56a1eaa0c32a33b0a2)
## [v2.3.1](https://github.com/ljharb/through/compare/v2.3.0...v2.3.1) - 2013-04-13
### Commits
- syntax error [`b90e6ba`](https://github.com/dominictarr/through/commit/b90e6ba08b626899f8007367d2a934714a9cdc23)
## [v2.3.0](https://github.com/ljharb/through/compare/v2.2.7...v2.3.0) - 2013-04-13
### Commits
- test autoDestroy option [`a2e1d5d`](https://github.com/dominictarr/through/commit/a2e1d5dad7f5ace3a174145ab32d58642bc1d685)
- document autoDestroy [`c4520e5`](https://github.com/dominictarr/through/commit/c4520e59f6a96f12eebfadef6a746d266b481d25)
- implement autoDestroy option [`1cabed2`](https://github.com/dominictarr/through/commit/1cabed2d3a57bec745d6a5c90d0c3077254dadf9)
## [v2.2.7](https://github.com/ljharb/through/compare/v2.2.6...v2.2.7) - 2013-03-15
### Merged
- Typo fix [`#10`](https://github.com/dominictarr/through/pull/10)
### Commits
- wider range [`e685bc2`](https://github.com/dominictarr/through/commit/e685bc2299f28d91c5a9d3eac7d929fdcff5767f)
## [v2.2.6](https://github.com/ljharb/through/compare/v2.2.5...v2.2.6) - 2013-03-13
### Commits
- update stream-spec [`1483cd4`](https://github.com/dominictarr/through/commit/1483cd44dbcd089c3bbb9e0111c09a64d0ecb715)
## [v2.2.5](https://github.com/ljharb/through/compare/v2.2.4...v2.2.5) - 2013-03-13
### Commits
- hopefully make this work in browserify [`a346472`](https://github.com/dominictarr/through/commit/a3464727990c9b273cec1b778b59aabb7bbc77c8)
- narrow testling range, so it does not take as long [`b1e474b`](https://github.com/dominictarr/through/commit/b1e474b029827673de4b35850d2116e7176171bf)
## [v2.2.4](https://github.com/ljharb/through/compare/v2.2.3...v2.2.4) - 2013-03-13
### Commits
- update stream spec [`f0f0c83`](https://github.com/dominictarr/through/commit/f0f0c83cd32a31dcf897b4eb310210440e975d89)
## [v2.2.3](https://github.com/ljharb/through/compare/v2.2.2...v2.2.3) - 2013-03-12
### Commits
- update stream-spec [`2d2e3e4`](https://github.com/dominictarr/through/commit/2d2e3e4ab429cd9c1a9a9d6b49488040012b0d33)
## [v2.2.2](https://github.com/ljharb/through/compare/v2.2.1...v2.2.2) - 2013-03-12
### Commits
- switch tests to use tape [`4a5652f`](https://github.com/dominictarr/through/commit/4a5652f8ada85dd8d212d558f386e2ab57f36d46)
- add testling setup to package.json [`bbe2a05`](https://github.com/dominictarr/through/commit/bbe2a05012b4855624893c24ebed1c24fb3d8107)
- fix test command [`12ec8a3`](https://github.com/dominictarr/through/commit/12ec8a34f6155ca7ea504aa1a0eaa30a869c90bc)
## [v2.2.1](https://github.com/ljharb/through/compare/2.2.0...v2.2.1) - 2013-03-03
### Merged
- doc [`#6`](https://github.com/dominictarr/through/pull/6)
## [2.2.0](https://github.com/ljharb/through/compare/v2.1.0...2.2.0) - 2013-02-11
### Merged
- Alias `queue()` to `push()` [`#5`](https://github.com/dominictarr/through/pull/5)
## [v2.1.0](https://github.com/ljharb/through/compare/v2.0.0...v2.1.0) - 2012-11-27
### Commits
- allow chaining [`6fbfd15`](https://github.com/dominictarr/through/commit/6fbfd158bc64a0df1b9cb8e6e462ab8109caaf09)
## [v2.0.0](https://github.com/ljharb/through/compare/v1.1.2...v2.0.0) - 2012-11-25
### Commits
- explain new api [`f5c1702`](https://github.com/dominictarr/through/commit/f5c17027e88d0cb8f51ba02dff058f909064617a)
- internal buffer should not be exposed [`97b40cc`](https://github.com/dominictarr/through/commit/97b40ccb4fe3058ad6d2d625c6d03297991a551a)
- use queue by default [`105677a`](https://github.com/dominictarr/through/commit/105677a705621f69ac5c2e42dc7f378b62eef937)
## [v1.1.2](https://github.com/ljharb/through/compare/v1.1.1...v1.1.2) - 2012-11-20
### Commits
- Ensure that end will be queued if paused with data [`c3efc00`](https://github.com/dominictarr/through/commit/c3efc00a7f381901096f0b3704aff2e2e3585330)
## [v1.1.1](https://github.com/ljharb/through/compare/v1.1.0...v1.1.1) - 2012-10-11
### Commits
- tidy [`42a2914`](https://github.com/dominictarr/through/commit/42a2914644a52981a9dbc94edbfe2d4677763817)
## [v1.1.0](https://github.com/ljharb/through/compare/v0.1.4...v1.1.0) - 2012-09-15
### Commits
- optional buffering [`63b41c6`](https://github.com/dominictarr/through/commit/63b41c6e073998cd8ed79a729339b1a728be088d)
- test for buffering [`9038d80`](https://github.com/dominictarr/through/commit/9038d8062ce4385fa34198d663597fae2b60b86d)
- test that end, close event correct [`7438a33`](https://github.com/dominictarr/through/commit/7438a333b3ab43121f654c26230fe0f39e3a33b1)
- update docs [`5f55881`](https://github.com/dominictarr/through/commit/5f5588176395d5934287205a599c0789150bc209)
- always emit drain [`58ce6ed`](https://github.com/dominictarr/through/commit/58ce6ed1fce57a777e8031384f1fa75ce185ec5d)
## [v0.1.4](https://github.com/ljharb/through/compare/v0.1.3...v0.1.4) - 2012-08-07
### Commits
- package.json: s/repo/repository/ [`6c811fa`](https://github.com/dominictarr/through/commit/6c811fa1c8d90b54f3d41e969720fb405f1de6c1)
## [v0.1.3](https://github.com/ljharb/through/compare/v0.1.2...v0.1.3) - 2012-08-07
### Commits
- fix repo links [`c49724d`](https://github.com/dominictarr/through/commit/c49724d51a4ca6bd3096451f98a7cd5b45b4386f)
## [v0.1.2](https://github.com/ljharb/through/compare/v0.1.1...v0.1.2) - 2012-07-23
### Commits
- do not emit pause event when already paused [`1e5a27e`](https://github.com/dominictarr/through/commit/1e5a27e2c49a82e769f4364126f7315894e81021)
## [v0.1.1](https://github.com/ljharb/through/compare/v0.1.0...v0.1.1) - 2012-07-23
### Commits
- fix typo [`3258738`](https://github.com/dominictarr/through/commit/325873812e1893472ab141b69fe48665cb5b7ac3)
## [v0.1.0](https://github.com/ljharb/through/compare/v0.0.4...v0.1.0) - 2012-07-23
### Commits
- emit pause on entering pause state [`2a003f9`](https://github.com/dominictarr/through/commit/2a003f9896b19978f6111e077acab870e5c9bbf6)
## [v0.0.4](https://github.com/ljharb/through/compare/v0.0.3...v0.0.4) - 2012-07-07
### Commits
- add opensource [`9691145`](https://github.com/dominictarr/through/commit/9691145e2791855294258ab02bbbdbb132a23c43)
- a bit better test coverage [`320ee05`](https://github.com/dominictarr/through/commit/320ee05d28b9aa7f0242446b803217947ad8d25f)
- do not throw on end if not writable, just ignore [`a04701b`](https://github.com/dominictarr/through/commit/a04701be062484c02d54b6515583b31930bed1f9)
## [v0.0.3](https://github.com/ljharb/through/compare/v0.0.2...v0.0.3) - 2012-07-05
### Commits
- remove from [`682c71e`](https://github.com/dominictarr/through/commit/682c71e0774f6442d7fc64ee4bc9b6a76fead177)
- add travis-ci [`8ccc78c`](https://github.com/dominictarr/through/commit/8ccc78c66989845e4f538fe9a041ebfe9f52f672)
- don't care about 0.4 [`df41950`](https://github.com/dominictarr/through/commit/df419507a80c30586ada6576780228cc39c5fbda)
## [v0.0.2](https://github.com/ljharb/through/compare/v0.0.1...v0.0.2) - 2012-07-05
### Commits
- document [`b238767`](https://github.com/dominictarr/through/commit/b2387678b54fdb08093eb3e23b54f3e1c8477237)
## v0.0.1 - 2012-07-05
### Commits
- initial [`903501a`](https://github.com/dominictarr/through/commit/903501acf73d03f584dd572b885c78c1bc9cca8b)
- add test script [`7359f4d`](https://github.com/dominictarr/through/commit/7359f4dfe0df20938f77bdbdf689eba78b8a0fa4)

24
node_modules/@ljharb/through/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,24 @@
The MIT License
Copyright (c) 2011 Dominic Tarr
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

85
node_modules/@ljharb/through/README.md generated vendored Normal file
View File

@@ -0,0 +1,85 @@
# @ljharb/through <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
*Note*: This package is a fork of https://npmjs.com/through, and builds off of it.
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
Easy way to create a `Stream` that is both `readable` and `writable`.
* Pass in optional `write` and `end` methods.
* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`.
* Use `this.pause()` and `this.resume()` to manage flow.
* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`).
This function is the basis for most of the synchronous streams in [event-stream](http://github.com/dominictarr/event-stream).
``` js
var through = require('through')
through(function write(data) {
this.queue(data) //data *must* not be null
},
function end () { //optional
this.queue(null)
})
```
Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`,
and this.emit('end')
``` js
var through = require('through')
through(function write(data) {
this.emit('data', data)
//this.pause()
},
function end () { //optional
this.emit('end')
})
```
## Extended Options
You will probably not need these 99% of the time.
### autoDestroy=false
By default, `through` emits close when the writable
and readable side of the stream has ended.
If that is not desired, set `autoDestroy=false`.
``` js
var through = require('through')
//like this
var ts = through(write, end, {autoDestroy: false})
//or like this
var ts = through(write, end)
ts.autoDestroy = false
```
## License
MIT / Apache2
[package-url]: https://npmjs.org/package/@ljharb/through
[npm-version-svg]: https://versionbadg.es/ljharb/through.svg
[deps-svg]: https://david-dm.org/ljharb/through.svg
[deps-url]: https://david-dm.org/ljharb/through
[dev-deps-svg]: https://david-dm.org/ljharb/through/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/through#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/@ljharb/through.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/@ljharb/through.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/@ljharb/through.svg
[downloads-url]: https://npm-stat.com/charts.html?package=@ljharb/through
[codecov-image]: https://codecov.io/gh/ljharb/through/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/through/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/through
[actions-url]: https://github.com/ljharb/through/actions

119
node_modules/@ljharb/through/index.js generated vendored Normal file
View File

@@ -0,0 +1,119 @@
'use strict';
var Stream = require('stream').Stream;
var callBind = require('call-bind');
// create a readable writable stream.
function through(write, end, opts) {
var writeBound = callBind(write || function (data) { this.queue(data); });
var endBound = callBind(end || function () { this.queue(null); });
var ended = false;
var destroyed = false;
var buffer = [];
var _ended = false;
var stream = new Stream();
stream.readable = true;
stream.writable = true;
stream.paused = false;
// stream.autoPause = !(opts && opts.autoPause === false)
stream.autoDestroy = !(opts && opts.autoDestroy === false);
stream.write = function (data) {
writeBound(this, data);
return !stream.paused;
};
function drain() {
while (buffer.length && !stream.paused) {
var data = buffer.shift();
if (data === null) { return stream.emit('end'); }
stream.emit('data', data);
}
}
stream.queue = function (data) {
// console.error(ended)
if (_ended) { return stream; }
if (data === null) { _ended = true; }
buffer.push(data);
drain();
return stream;
};
stream.push = stream.queue;
/*
* this will be registered as the first 'end' listener
* must call destroy next tick, to make sure we're after any
* stream piped from here.
* this is only a problem if end is not emitted synchronously.
* a nicer way to do this is to make sure this is the last listener for 'end'
*/
stream.on('end', function () {
stream.readable = false;
if (!stream.writable && stream.autoDestroy) {
process.nextTick(function () {
stream.destroy();
});
}
});
function _end() {
stream.writable = false;
endBound(stream);
if (!stream.readable && stream.autoDestroy) { stream.destroy(); }
}
stream.end = function (data) {
if (ended) { return; }
ended = true;
if (arguments.length) { stream.write(data); }
_end(); // will emit or queue
return stream;
};
stream.destroy = function () {
if (destroyed) { return; }
destroyed = true;
ended = true;
buffer.length = 0;
stream.writable = false;
stream.readable = false;
stream.emit('close');
return stream;
};
stream.pause = function () {
if (stream.paused) { return; }
stream.paused = true;
return stream;
};
stream.resume = function () {
if (stream.paused) {
stream.paused = false;
stream.emit('resume');
}
drain();
/*
* may have become paused again,
* as drain emits 'data'.
*/
if (!stream.paused) { stream.emit('drain'); }
return stream;
};
return stream;
}
/*
* through
*
* a stream that does nothing but re-emit the input.
* useful for aggregating a series of changing but not ending streams into one stream)
*/
module.exports = through;
through.through = through;

67
node_modules/@ljharb/through/package.json generated vendored Normal file
View File

@@ -0,0 +1,67 @@
{
"name": "@ljharb/through",
"version": "2.3.11",
"description": "simplified stream construction",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"dependencies": {
"call-bind": "^1.0.2"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.3",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"from": "^0.1.7",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"stream-spec": "^0.3.6",
"tape": "^5.7.0"
},
"keywords": [
"stream",
"streams",
"user-streams",
"pipe"
],
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/through.git"
},
"homepage": "https://github.com/ljharb/through",
"testling": {
"files": "test/*.js"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true,
"startingVersion": "2.3.9"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

29
node_modules/@ljharb/through/test/async.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
'use strict';
var from = require('from');
var through = require('../');
var tape = require('tape');
tape('simple async example', function (t) {
var expected = [1, 2, 3, 4, 5];
var actual = [];
from(expected)
.pipe(through(function (data) {
this.pause();
setTimeout(function () {
console.log('pushing data', data);
this.push(data);
this.resume();
}.bind(this), 300);
})).pipe(through(function (data) {
console.log('pushing data second time', data);
this.push(data);
})).on('data', function (d) {
actual.push(d);
}).on('end', function () {
t.deepEqual(actual, expected);
t.end();
});
});

33
node_modules/@ljharb/through/test/auto-destroy.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
'use strict';
var test = require('tape');
var through = require('../');
// must emit end before close.
test('end before close', function (assert) {
var ts = through();
ts.autoDestroy = false;
var ended = false;
var closed = false;
ts.on('end', function () {
assert.ok(!closed);
ended = true;
});
ts.on('close', function () {
assert.ok(ended);
closed = true;
});
ts.write(1);
ts.write(2);
ts.write(3);
ts.end();
assert.ok(ended);
assert.notOk(closed);
ts.destroy();
assert.ok(closed);
assert.end();
});

70
node_modules/@ljharb/through/test/buffering.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
'use strict';
var test = require('tape');
var through = require('../');
// must emit end before close.
test('buffering', function (assert) {
var ts = through(function (data) {
this.queue(data);
}, function () {
this.queue(null);
});
var ended = false;
var actual = [];
ts.on('data', actual.push.bind(actual));
ts.on('end', function () {
ended = true;
});
ts.write(1);
ts.write(2);
ts.write(3);
assert.deepEqual(actual, [1, 2, 3]);
ts.pause();
ts.write(4);
ts.write(5);
ts.write(6);
assert.deepEqual(actual, [1, 2, 3]);
ts.resume();
assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]);
ts.pause();
ts.end();
assert.ok(!ended);
ts.resume();
assert.ok(ended);
assert.end();
});
test('buffering has data in queue, when ends', function (assert) {
// If stream ends while paused with data in the queue, stream should still emit end after all data is written on resume.
var ts = through(function (data) {
this.queue(data);
}, function () {
this.queue(null);
});
var ended = false;
var actual = [];
ts.on('data', actual.push.bind(actual));
ts.on('end', function () {
ended = true;
});
ts.pause();
ts.write(1);
ts.write(2);
ts.write(3);
ts.end();
assert.deepEqual(actual, [], 'no data written yet, still paused');
assert.ok(!ended, 'end not emitted yet, still paused');
ts.resume();
assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered');
assert.ok(ended, 'end should be emitted once all data was delivered');
assert.end();
});

47
node_modules/@ljharb/through/test/end.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
'use strict';
var test = require('tape');
var through = require('../');
// must emit end before close.
test('end before close', function (assert) {
var ts = through();
var ended = false;
var closed = false;
ts.on('end', function () {
assert.ok(!closed);
ended = true;
});
ts.on('close', function () {
assert.ok(ended);
closed = true;
});
ts.write(1);
ts.write(2);
ts.write(3);
ts.end();
assert.ok(ended);
assert.ok(closed);
assert.end();
});
test('end only once', function (t) {
var ts = through();
var ended = false;
ts.on('end', function () {
t.equal(ended, false);
ended = true;
});
ts.queue(null);
ts.queue(null);
ts.queue(null);
ts.resume();
t.end();
});

129
node_modules/@ljharb/through/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
'use strict';
var test = require('tape');
var spec = require('stream-spec');
var through = require('../');
/*
*I'm using these two functions, and not streams and pipe
*so there is less to break. if this test fails it must be
*the implementation of _through_
*/
function write(array, stream) {
array = array.slice();
function next() {
while (array.length) { if (stream.write(array.shift()) === false) { return stream.once('drain', next); } }
stream.end();
}
next();
}
function read(stream, callback) {
var actual = [];
stream.on('data', function (data) {
actual.push(data);
});
stream.once('end', function () {
callback(null, actual);
});
stream.once('error', function (err) {
callback(err);
});
}
test('simple defaults', function (assert) {
var l = 1000;
var expected = [];
while (l--) { expected.push(l * Math.random()); }
var t = through();
var s = spec(t).through().pausable();
read(t, function (err, actual) {
assert.ifError(err);
assert.deepEqual(actual, expected);
assert.end();
});
t.on('close', s.validate);
write(expected, t);
});
test('simple functions', function (assert) {
var l = 1000;
var expected = [];
while (l--) { expected.push(l * Math.random()); }
var t = through(function (data) {
this.emit('data', data * 2);
});
var s = spec(t).through().pausable();
read(t, function (err, actual) {
assert.ifError(err);
assert.deepEqual(actual, expected.map(function (data) {
return data * 2;
}));
assert.end();
});
t.on('close', s.validate);
write(expected, t);
});
test('pauses', function (assert) {
var l = 1000;
var expected = [];
while (l--) { expected.push(l); } // Math.random())
var t = through();
var s = spec(t)
.through()
.pausable();
t.on('data', function () {
if (Math.random() > 0.1) { return; }
t.pause();
process.nextTick(function () {
t.resume();
});
});
read(t, function (err, actual) {
assert.ifError(err);
assert.deepEqual(actual, expected);
});
t.on('close', function () {
s.validate();
assert.end();
});
write(expected, t);
});
test('does not soft-end on `undefined`', function (assert) {
var stream = through();
var count = 0;
stream.on('data', function () {
count += 1;
});
stream.write(undefined);
stream.write(undefined);
assert.equal(count, 2);
assert.end();
});