Skip to content

Commit

Permalink
regenerate build for Node v8.17.0
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Feb 23, 2023
1 parent 8f734ef commit 63e4651
Show file tree
Hide file tree
Showing 22 changed files with 1,098 additions and 119 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# readable-stream

***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
***Node-core v8.17.0 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)


[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
Expand All @@ -18,7 +18,7 @@ npm install --save readable-stream
This package is a mirror of the Streams2 and Streams3 implementations in
Node-core.

Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html).
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.17.0/docs/api/stream.html).

If you want to guarantee a stable streams base, regardless of what version of
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
Expand Down
8 changes: 4 additions & 4 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var Stream = require('./internal/streams/stream');
/*<replacement>*/

var Buffer = require('safe-buffer').Buffer;
var OurUint8Array = global.Uint8Array || function () {};
var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
Expand Down Expand Up @@ -623,8 +623,8 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
// also returned false.
// => Check whether `dest` is still a piping destination.
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug('false write response, pause', src._readableState.awaitDrain);
src._readableState.awaitDrain++;
debug('false write response, pause', state.awaitDrain);
state.awaitDrain++;
increasedAwaitDrain = true;
}
src.pause();
Expand Down Expand Up @@ -718,7 +718,7 @@ Readable.prototype.unpipe = function (dest) {
state.flowing = false;

for (var i = 0; i < len; i++) {
dests[i].emit('unpipe', this, unpipeInfo);
dests[i].emit('unpipe', this, { hasUnpiped: false });
}return this;
}

Expand Down
14 changes: 6 additions & 8 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var Stream = require('./internal/streams/stream');
/*<replacement>*/

var Buffer = require('safe-buffer').Buffer;
var OurUint8Array = global.Uint8Array || function () {};
var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
Expand Down Expand Up @@ -349,7 +349,7 @@ Writable.prototype.uncork = function () {
if (state.corked) {
state.corked--;

if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
}
};

Expand Down Expand Up @@ -591,7 +591,7 @@ Writable.prototype.end = function (chunk, encoding, cb) {
}

// ignore unnecessary end() calls.
if (!state.ending && !state.finished) endWritable(this, state, cb);
if (!state.ending) endWritable(this, state, cb);
};

function needFinish(state) {
Expand Down Expand Up @@ -652,11 +652,9 @@ function onCorkedFinish(corkReq, state, err) {
cb(err);
entry = entry.next;
}
if (state.corkedRequestsFree) {
state.corkedRequestsFree.next = corkReq;
} else {
state.corkedRequestsFree = corkReq;
}

// reuse the free corkReq.
state.corkedRequestsFree.next = corkReq;
}

Object.defineProperty(Writable.prototype, 'destroyed', {
Expand Down
1 change: 0 additions & 1 deletion lib/internal/streams/BufferList.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ module.exports = function () {

BufferList.prototype.concat = function concat(n) {
if (this.length === 0) return Buffer.alloc(0);
if (this.length === 1) return this.head.data;
var ret = Buffer.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
Expand Down
18 changes: 14 additions & 4 deletions lib/internal/streams/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ function destroy(err, cb) {
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
pna.nextTick(emitErrorNT, this, err);
} else if (err) {
if (!this._writableState) {
pna.nextTick(emitErrorNT, this, err);
} else if (!this._writableState.errorEmitted) {
this._writableState.errorEmitted = true;
pna.nextTick(emitErrorNT, this, err);
}
}

return this;
}

Expand All @@ -35,9 +41,11 @@ function destroy(err, cb) {

this._destroy(err || null, function (err) {
if (!cb && err) {
pna.nextTick(emitErrorNT, _this, err);
if (_this._writableState) {
if (!_this._writableState) {
pna.nextTick(emitErrorNT, _this, err);
} else if (!_this._writableState.errorEmitted) {
_this._writableState.errorEmitted = true;
pna.nextTick(emitErrorNT, _this, err);
}
} else if (cb) {
cb(err);
Expand All @@ -59,6 +67,8 @@ function undestroy() {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finalCalled = false;
this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
Expand Down
198 changes: 186 additions & 12 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ This directory contains modules used to test the Node.js implementation.
* [DNS module](#dns-module)
* [Duplex pair helper](#duplex-pair-helper)
* [Fixtures module](#fixtures-module)
* [HTTP2 module](#http2-module)
* [Internet module](#internet-module)
* [tmpdir module](#tmpdir-module)
* [WPT module](#wpt-module)

## Benchmark Module
Expand Down Expand Up @@ -249,6 +252,11 @@ Platform check for Windows.

Platform check for Windows 32-bit on Windows 64-bit.

### isCPPSymbolsNotMapped
* [&lt;Boolean>]

Platform check for C++ symbols are mapped or not.

### leakedGlobals()
* return [&lt;Array>]

Expand All @@ -275,6 +283,17 @@ fail.

If `fn` is not provided, an empty function will be used.

### mustCallAsync([fn][, exact])
* `fn` [&lt;Function>]
* `exact` [&lt;Number>] default = 1
* return [&lt;Function>]

The same as `mustCall()`, except that it is also checked that the Promise
returned by the function is fulfilled for each invocation of the function.

The return value of the wrapped function is the return value of the original
function, if necessary wrapped as a promise.

### mustCallAtLeast([fn][, minimum])
* `fn` [&lt;Function>] default = () => {}
* `minimum` [&lt;Number>] default = 1
Expand Down Expand Up @@ -328,11 +347,6 @@ A port number for tests to use if one is needed.

Logs '1..0 # Skipped: ' + `msg`

### refreshTmpDir()
* return [&lt;String>]

Deletes the testing 'tmp' directory and recreates it.

### restoreStderr()

Restore the original `process.stderr.write`. Used to restore `stderr` to its
Expand Down Expand Up @@ -385,17 +399,12 @@ Platform normalizes the `pwd` command.

Synchronous version of `spawnPwd`.

### tmpDir
* [&lt;String>]

The realpath of the 'tmp' directory.

## Countdown Module

The `Countdown` module provides a simple countdown mechanism for tests that
require a particular action to be taken after a given number of completed
tasks (for instance, shutting down an HTTP server after a specific number of
requests).
requests). The Countdown will fail the test if the remainder did not reach 0.

<!-- eslint-disable strict, required-modules -->
```js
Expand Down Expand Up @@ -428,7 +437,26 @@ called before the callback is invoked.

## DNS Module

The `DNS` module provides a naïve DNS parser/serializer.
The `DNS` module provides utilities related to the `dns` built-in module.

### errorLookupMock(code, syscall)

* `code` [&lt;String>] Defaults to `dns.mockedErrorCode`.
* `syscall` [&lt;String>] Defaults to `dns.mockedSysCall`.
* return [&lt;Function>]


A mock for the `lookup` option of `net.connect()` that would result in an error
with the `code` and the `syscall` specified. Returns a function that has the
same signature as `dns.lookup()`.

### mockedErrorCode

The default `code` of errors generated by `errorLookupMock`.

### mockedSysCall

The default `syscall` of errors generated by `errorLookupMock`.

### readDomainFromPacket(buffer, offset)

Expand Down Expand Up @@ -508,6 +536,151 @@ Returns the result of
Returns the result of
`fs.readFileSync(path.join(fixtures.fixturesDir, 'keys', arg), 'enc')`.

## HTTP/2 Module

The http2.js module provides a handful of utilities for creating mock HTTP/2
frames for testing of HTTP/2 endpoints

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
const http2 = require('../common/http2');
```

### Class: Frame

The `http2.Frame` is a base class that creates a `Buffer` containing a
serialized HTTP/2 frame header.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// length is a 24-bit unsigned integer
// type is an 8-bit unsigned integer identifying the frame type
// flags is an 8-bit unsigned integer containing the flag bits
// id is the 32-bit stream identifier, if any.
const frame = new http2.Frame(length, type, flags, id);

// Write the frame data to a socket
socket.write(frame.data);
```

The serialized `Buffer` may be retrieved using the `frame.data` property.

### Class: DataFrame extends Frame

The `http2.DataFrame` is a subclass of `http2.Frame` that serializes a `DATA`
frame.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// id is the 32-bit stream identifier
// payload is a Buffer containing the DATA payload
// padlen is an 8-bit integer giving the number of padding bytes to include
// final is a boolean indicating whether the End-of-stream flag should be set,
// defaults to false.
const frame = new http2.DataFrame(id, payload, padlen, final);

socket.write(frame.data);
```

### Class: HeadersFrame

The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a
`HEADERS` frame.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// id is the 32-bit stream identifier
// payload is a Buffer containing the HEADERS payload (see either
// http2.kFakeRequestHeaders or http2.kFakeResponseHeaders).
// padlen is an 8-bit integer giving the number of padding bytes to include
// final is a boolean indicating whether the End-of-stream flag should be set,
// defaults to false.
const frame = new http2.HeadersFrame(id, payload, padlen, final);

socket.write(frame.data);
```

### Class: SettingsFrame

The `http2.SettingsFrame` is a subclass of `http2.Frame` that serializes an
empty `SETTINGS` frame.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
// ack is a boolean indicating whether or not to set the ACK flag.
const frame = new http2.SettingsFrame(ack);

socket.write(frame.data);
```

### http2.kFakeRequestHeaders

Set to a `Buffer` instance that contains a minimal set of serialized HTTP/2
request headers to be used as the payload of a `http2.HeadersFrame`.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
const frame = new http2.HeadersFrame(1, http2.kFakeRequestHeaders, 0, true);

socket.write(frame.data);
```

### http2.kFakeResponseHeaders

Set to a `Buffer` instance that contains a minimal set of serialized HTTP/2
response headers to be used as the payload a `http2.HeadersFrame`.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
const frame = new http2.HeadersFrame(1, http2.kFakeResponseHeaders, 0, true);

socket.write(frame.data);
```

### http2.kClientMagic

Set to a `Buffer` containing the preamble bytes an HTTP/2 client must send
upon initial establishment of a connection.

<!-- eslint-disable no-undef, no-unused-vars, required-modules, strict -->
```js
socket.write(http2.kClientMagic);
```

## Internet Module

The `common/internet` module provides utilities for working with
internet-related tests.

### internet.addresses

* [&lt;Object>]
* `INET_HOST` [&lt;String>] A generic host that has registered common
DNS records, supports both IPv4 and IPv6, and provides basic HTTP/HTTPS
services
* `INET4_HOST` [&lt;String>] A host that provides IPv4 services
* `INET6_HOST` [&lt;String>] A host that provides IPv6 services
* `INET4_IP` [&lt;String>] An accessible IPv4 IP, defaults to the
Google Public DNS IPv4 address
* `INET6_IP` [&lt;String>] An accessible IPv6 IP, defaults to the
Google Public DNS IPv6 address
* `INVALID_HOST` [&lt;String>] An invalid host that cannot be resolved
* `MX_HOST` [&lt;String>] A host with MX records registered
* `SRV_HOST` [&lt;String>] A host with SRV records registered
* `PTR_HOST` [&lt;String>] A host with PTR records registered
* `NAPTR_HOST` [&lt;String>] A host with NAPTR records registered
* `SOA_HOST` [&lt;String>] A host with SOA records registered
* `CNAME_HOST` [&lt;String>] A host with CNAME records registered
* `NS_HOST` [&lt;String>] A host with NS records registered
* `TXT_HOST` [&lt;String>] A host with TXT records registered
* `DNS4_SERVER` [&lt;String>] An accessible IPv4 DNS server
* `DNS6_SERVER` [&lt;String>] An accessible IPv6 DNS server

A set of addresses for internet-related tests. All properties are configurable
via `NODE_TEST_*` environment variables. For example, to configure
`internet.addresses.INET_HOST`, set the environment
variable `NODE_TEST_INET_HOST` to a specified host.

## WPT Module

The wpt.js module is a port of parts of
Expand All @@ -517,6 +690,7 @@ Node.js
implementation with tests from
[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests).


[&lt;Array>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
[&lt;ArrayBufferView&#91;&#93;>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView
[&lt;Boolean>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type
Expand Down

0 comments on commit 63e4651

Please sign in to comment.