Skip to content

Commit 302d0c4

Browse files
committed
separate streams implementations for maintenance
1 parent 71a0056 commit 302d0c4

32 files changed

+1621
-1463
lines changed

src/node/internal/internal_errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ export class ConnResetException extends NodeError {
762762

763763
export function aggregateTwoErrors(
764764
innerError: unknown,
765-
outerError: Error | null
765+
outerError: Error | null | undefined
766766
): AggregateError {
767767
if (innerError && outerError && innerError !== outerError) {
768768
if ('errors' in outerError && Array.isArray(outerError.errors)) {

src/node/internal/internal_fs_streams.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ import type {
4040

4141
import type { FileHandle } from 'node-internal:internal_fs_promises';
4242

43-
import { errorOrDestroy, eos } from 'node-internal:streams_util';
43+
import { errorOrDestroy } from 'node-internal:streams_destroy';
44+
import { eos } from 'node-internal:streams_end_of_stream';
4445

4546
import {
4647
ERR_INVALID_ARG_VALUE,
@@ -541,7 +542,7 @@ function readImpl(this: ReadStream, n: number): void {
541542
}
542543

543544
if (er) {
544-
errorOrDestroy(this, er);
545+
errorOrDestroy(this, er as Error);
545546
return;
546547
}
547548

src/node/internal/internal_http_client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
validateNumber,
3030
} from 'node-internal:validators';
3131
import { getTimerDuration } from 'node-internal:internal_net';
32-
import { addAbortSignal } from 'node-internal:streams_util';
32+
import { addAbortSignal } from 'node-internal:streams_add_abort_signal';
3333
import { Writable } from 'node-internal:streams_writable';
3434
import type {
3535
ClientRequest as _ClientRequest,
@@ -79,7 +79,7 @@ export class ClientRequest extends OutgoingMessage implements _ClientRequest {
7979
agent: Agent | undefined;
8080

8181
// Unused fields required to be Node.js compatible.
82-
aborted: boolean = false;
82+
override aborted: boolean = false;
8383
reusedSocket: boolean = false;
8484
maxHeadersCount: number = Infinity;
8585
connection: Socket | null = null;
@@ -168,6 +168,7 @@ export class ClientRequest extends OutgoingMessage implements _ClientRequest {
168168

169169
const signal = options.signal;
170170
if (signal) {
171+
// @ts-expect-error TS2379 Type incompatibility with exactOptionalPropertyTypes
171172
addAbortSignal(signal, this);
172173
}
173174
let method = options.method;

src/node/internal/internal_http_incoming.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
// https://opensource.org/licenses/Apache-2.0
44
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
55

6-
// this.aborted attribute is set as deprecated in @types/node package.
7-
/* eslint-disable @typescript-eslint/no-deprecated */
8-
96
import { EventEmitter } from 'node-internal:events';
107
import { Readable } from 'node-internal:streams_readable';
118
import { isIPv4, Socket } from 'node-internal:internal_net';
@@ -43,7 +40,7 @@ export class IncomingMessage extends Readable implements _IncomingMessage {
4340
#socket: unknown;
4441
#stream: ReadableStream | null = null;
4542

46-
aborted = false;
43+
override aborted = false;
4744
url: string = '';
4845
// @ts-expect-error TS2416 Type-inconsistencies
4946
method: string | null = null;

src/node/internal/internal_http_outgoing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { validateString } from 'node-internal:validators';
1010
import { Writable } from 'node-internal:streams_writable';
11-
import { getDefaultHighWaterMark } from 'node-internal:streams_util';
11+
import { getDefaultHighWaterMark } from 'node-internal:streams_state';
1212
import type { DataWrittenEvent } from 'node-internal:internal_http_server';
1313
import {
1414
ERR_HTTP_HEADERS_SENT,
@@ -228,7 +228,7 @@ export class OutgoingMessage extends Writable implements _OutgoingMessage {
228228
maxRequestsOnConnectionReached = false;
229229

230230
// These are attributes provided by the Node.js implementation.
231-
_closed = false;
231+
override _closed = false;
232232
_headerSent = false;
233233
_onPendingData: (delta: number) => void = () => {};
234234
_header: string | null = null;

src/node/internal/internal_http_server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
ERR_SERVER_ALREADY_LISTEN,
2525
} from 'node-internal:internal_errors';
2626
import { EventEmitter } from 'node-internal:events';
27-
import { getDefaultHighWaterMark } from 'node-internal:streams_util';
27+
import { getDefaultHighWaterMark } from 'node-internal:streams_state';
2828
import {
2929
kUniqueHeaders,
3030
OutgoingMessage,

src/node/internal/internal_net.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ export function Socket(this: Socket, options?: SocketOptions): Socket {
331331
// Call Duplex constructor before setting up the abort signal
332332
// This ensures the stream methods are properly set up before
333333
// any abort handling that might call destroy()
334+
// @ts-expect-error TS2379 Type incompatibility with exactOptionalPropertyTypes
334335
Duplex.call(this, options);
335336

336337
if (options.handle) {

src/node/internal/internal_tls_wrap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import type {
3838
TlsOptions,
3939
TLSSocket as TLSSocketType,
4040
} from 'node:tls';
41-
import type { Duplex } from 'node:stream';
41+
import type { Duplex } from 'node-internal:streams_duplex';
4242
import type { OnReadOpts, TcpSocketConnectOpts } from 'node:net';
4343
import {
4444
validateBuffer,
@@ -702,6 +702,7 @@ export function connect(...args: unknown[]): TLSSocket {
702702
);
703703
}
704704

705+
// @ts-expect-error TS2345 Type incompatibility between Node.js Duplex and internal Duplex
705706
const tlssock = new TLSSocket(options.socket, {
706707
allowHalfOpen: options.allowHalfOpen,
707708
pipe: !!options.path,
@@ -710,7 +711,6 @@ export function connect(...args: unknown[]): TLSSocket {
710711
highWaterMark: options.highWaterMark,
711712
secureContext: options.secureContext,
712713
checkServerIdentity: options.checkServerIdentity ?? checkServerIdentity,
713-
// @ts-expect-error TS2412 Type inconsistencies between types/node
714714
onread: options.onread,
715715
signal: options.signal,
716716
lookup: options.lookup,

src/node/internal/internal_zlib_base.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
NodeError,
2323
} from 'node-internal:internal_errors';
2424
import { Transform, type DuplexOptions } from 'node-internal:streams_transform';
25-
import { eos as finished } from 'node-internal:streams_util';
25+
import { eos as finished } from 'node-internal:streams_end_of_stream';
2626
import {
2727
isArrayBufferView,
2828
isAnyArrayBuffer,
@@ -439,6 +439,8 @@ export class ZlibBase extends Transform {
439439
this._maxOutputLength = maxOutputLength;
440440
}
441441

442+
// Note: This is intentionally a getter that shadows the property from Transform
443+
// @ts-expect-error TS2611 Property/accessor mismatch with Transform._closed
442444
get _closed(): boolean {
443445
return this._handle == null;
444446
}

src/node/internal/public_process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function chunkToBuffer(
6161
// For stdout, we emulate `nohup node foo.js`
6262
class SyncWriteStream extends Writable {
6363
fd: number;
64-
readable: boolean;
64+
override readable: boolean;
6565
_type = 'fs';
6666
_isStdio = true;
6767
constructor(fd: number) {

0 commit comments

Comments
 (0)