File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { Writable } from "./writable";
8
8
9
9
type DuplexClass = new ( ) => stream . Duplex ;
10
10
11
- export const Duplex : DuplexClass = class {
11
+ export const _Duplex : DuplexClass = class {
12
12
allowHalfOpen : boolean = true ;
13
13
private _destroy : ( error ?: Error ) => void ;
14
14
@@ -19,5 +19,8 @@ export const Duplex: DuplexClass = class {
19
19
}
20
20
} as any ;
21
21
22
- Object . assign ( Duplex . prototype , Readable . prototype ) ;
23
- Object . assign ( Duplex . prototype , Writable . prototype ) ;
22
+ Object . assign ( _Duplex . prototype , Readable . prototype ) ;
23
+ Object . assign ( _Duplex . prototype , Writable . prototype ) ;
24
+
25
+ export const Duplex : typeof stream . Duplex =
26
+ ( globalThis as any ) . Duplex || _Duplex ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { EventEmitter } from "../events";
7
7
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/readable.js
8
8
9
9
// eslint-disable-next-line unicorn/prefer-event-target
10
- export class Readable extends EventEmitter implements stream . Readable {
10
+ export class _Readable extends EventEmitter implements stream . Readable {
11
11
__unenv__ : unknown = true ;
12
12
13
13
readonly readableEncoding : BufferEncoding | null = null ;
@@ -28,7 +28,7 @@ export class Readable extends EventEmitter implements stream.Readable {
28
28
_iterable : Iterable < any > | AsyncIterable < any > ,
29
29
options ?: stream . ReadableOptions ,
30
30
) {
31
- return new Readable ( options ) ;
31
+ return new _Readable ( options ) ;
32
32
}
33
33
34
34
constructor ( _opts ?: stream . ReadableOptions ) {
@@ -92,3 +92,6 @@ export class Readable extends EventEmitter implements stream.Readable {
92
92
throw new Error ( "[h3] Method not implemented." ) ;
93
93
}
94
94
}
95
+
96
+ export const Readable : typeof stream . Readable =
97
+ ( globalThis as any ) . Readable || _Readable ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Duplex } from "./duplex";
4
4
// Docs: https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams
5
5
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/transform.js
6
6
7
- export class Transform extends Duplex implements stream . Transform {
7
+ export class _Transform extends Duplex implements stream . Transform {
8
8
readonly __unenv__ = true ;
9
9
10
10
_transform (
@@ -15,3 +15,6 @@ export class Transform extends Duplex implements stream.Transform {
15
15
16
16
_flush ( callback : stream . TransformCallback ) : void { }
17
17
}
18
+
19
+ export const Transform : typeof stream . Transform =
20
+ ( globalThis as any ) . Transform || _Transform ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { EventEmitter } from "../events";
6
6
// Docs: https://nodejs.org/api/stream.html#stream_writable_streams
7
7
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/writable.js
8
8
// eslint-disable-next-line unicorn/prefer-event-target
9
- export class Writable extends EventEmitter implements stream . Writable {
9
+ class _Writable extends EventEmitter implements stream . Writable {
10
10
readonly __unenv__ = true ;
11
11
12
12
readonly writable : boolean = true ;
@@ -133,3 +133,6 @@ export class Writable extends EventEmitter implements stream.Writable {
133
133
throw new Error ( "[h3] Method not implemented." ) ;
134
134
}
135
135
}
136
+
137
+ export const Writable : typeof stream . Writable =
138
+ ( globalThis as any ) . Writable || _Writable ;
You can’t perform that action at this time.
0 commit comments