-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
128 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { notImplemented } from '../../../_internal/utils' | ||
import type * as stramConsumers from 'stream/consumers' | ||
|
||
export const arrayBuffer = notImplemented('stream.consumers.arrayBuffer') | ||
export const blob = notImplemented('stream.consumers.blob') | ||
export const buffer = notImplemented('stream.consumers.buffer') | ||
export const text = notImplemented('stream.consumers.text') | ||
export const json = notImplemented('stream.consumers.json') | ||
|
||
export default <typeof stramConsumers> { | ||
arrayBuffer, | ||
blob, | ||
buffer, | ||
text, | ||
json | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,52 @@ | ||
// https://nodejs.org/api/stream.html | ||
import type stream from 'node:stream' | ||
import * as readable from './readable' | ||
import * as writable from './writable' | ||
import * as duplex from './duplex' | ||
import * as transform from './transform' | ||
import * as mock from './mock' | ||
import stream from 'node:stream' | ||
import { Readable } from './readable' | ||
import { Writable } from './writable' | ||
import { Duplex } from './duplex' | ||
import { Transform } from './transform' | ||
import mock from '../../mock/proxy' | ||
import { notImplemented } from '../../_internal/utils' | ||
|
||
export * from './readable' | ||
export * from './writable' | ||
export * from './duplex' | ||
export * from './transform' | ||
export * from './mock' | ||
import promises from './promises/index' | ||
|
||
// @ts-ignore | ||
export default <typeof stream> { | ||
...readable, | ||
...writable, | ||
...duplex, | ||
...transform, | ||
...mock | ||
export { Readable } from './readable' | ||
export { Writable } from './writable' | ||
export { Duplex } from './duplex' | ||
export { Transform } from './transform' | ||
|
||
export const Stream: stream.Stream = mock.__createMock__('Stream') | ||
export const PassThrough: stream.PassThrough = mock.__createMock__('PassThrough') | ||
|
||
export const pipeline: typeof stream.pipeline = notImplemented('stream.pipeline') as any | ||
export const finished: typeof stream.finished = notImplemented('stream.finished') as any | ||
export const addAbortSignal: typeof stream.addAbortSignal = notImplemented('stream.addAbortSignal') | ||
|
||
// Internal | ||
interface StreamInternal { isDisturbed: any, isReadable: any, compose: any, isErrored: any, destroy: any, _isUint8Array: any, _uint8ArrayToBuffer: any } | ||
export const isDisturbed = notImplemented('stream.isDisturbed') | ||
export const isReadable = notImplemented('stream.isReadable') | ||
export const compose = notImplemented('stream.compose') | ||
export const isErrored = notImplemented('stream.isErrored') | ||
export const destroy = notImplemented('stream.destroy') | ||
export const _isUint8Array = notImplemented('stream._isUint8Array') | ||
export const _uint8ArrayToBuffer = notImplemented('stream._uint8ArrayToBuffer') | ||
|
||
export default <typeof stream & StreamInternal> { | ||
Readable: Readable as unknown as typeof stream.Readable, | ||
Writable: Writable as unknown as typeof stream.Writable, | ||
Duplex: Duplex as unknown as typeof stream.Duplex, | ||
Transform: Transform as unknown as typeof stream.Transform, | ||
Stream: Stream as unknown as typeof stream.Stream, | ||
PassThrough: PassThrough as unknown as typeof stream.PassThrough, | ||
pipeline, | ||
finished, | ||
addAbortSignal, | ||
promises, | ||
isDisturbed, | ||
isReadable, | ||
compose, | ||
_uint8ArrayToBuffer, | ||
isErrored, | ||
destroy, | ||
_isUint8Array | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { notImplemented } from '../../../_internal/utils' | ||
import type * as stramPromises from 'stream/promises' | ||
|
||
export const finished = notImplemented('stream.promises.finished') | ||
export const pipeline = notImplemented('stream.promises.pipeline') | ||
|
||
export default <typeof stramPromises> { | ||
finished, | ||
pipeline | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { notImplemented } from '../../../_internal/utils' | ||
import type * as stramWeb from 'stream/web' | ||
|
||
export const ReadableStream = globalThis.ReadableStream || notImplemented('stream.web.ReadableStream') | ||
export const ReadableStreamDefaultReader = globalThis.ReadableStreamDefaultReader || notImplemented('stream.web.ReadableStreamDefaultReader') | ||
// @ts-ignore | ||
export const ReadableStreamBYOBReader = globalThis.ReadableStreamBYOBReader || notImplemented('stream.web.ReadableStreamBYOBReader') | ||
// @ts-ignore | ||
export const ReadableStreamBYOBRequest = globalThis.ReadableStreamBYOBRequest || notImplemented('stream.web.ReadableStreamBYOBRequest') | ||
// @ts-ignore | ||
export const ReadableByteStreamController = globalThis.ReadableByteStreamController || notImplemented('stream.web.ReadableByteStreamController') | ||
export const ReadableStreamDefaultController = globalThis.ReadableStreamDefaultController || notImplemented('stream.web.ReadableStreamDefaultController') | ||
export const TransformStream = globalThis.TransformStream || notImplemented('stream.web.TransformStream') | ||
export const TransformStreamDefaultController = globalThis.TransformStreamDefaultController || notImplemented('stream.web.TransformStreamDefaultController') | ||
export const WritableStream = globalThis.WritableStream || notImplemented('stream.web.WritableStream') | ||
export const WritableStreamDefaultWriter = globalThis.WritableStreamDefaultWriter || notImplemented('stream.web.WritableStreamDefaultWriter') | ||
export const WritableStreamDefaultController = globalThis.WritableStreamDefaultController || notImplemented('stream.web.WritableStreamDefaultController') | ||
export const ByteLengthQueuingStrategy = globalThis.ByteLengthQueuingStrategy || notImplemented('stream.web.ByteLengthQueuingStrategy') | ||
export const CountQueuingStrategy = globalThis.CountQueuingStrategy || notImplemented('stream.web.CountQueuingStrategy') | ||
export const TextEncoderStream = globalThis.TextEncoderStream || notImplemented('stream.web.TextEncoderStream') | ||
export const TextDecoderStream = globalThis.TextDecoderStream || notImplemented('stream.web.TextDecoderStream') | ||
|
||
// @ts-ignore | ||
export default <typeof stramWeb> { | ||
ReadableStream, | ||
ReadableStreamDefaultReader, | ||
ReadableStreamBYOBReader, | ||
ReadableStreamBYOBRequest, | ||
ReadableByteStreamController, | ||
ReadableStreamDefaultController, | ||
TransformStream, | ||
TransformStreamDefaultController, | ||
WritableStream, | ||
WritableStreamDefaultWriter, | ||
WritableStreamDefaultController, | ||
ByteLengthQueuingStrategy, | ||
CountQueuingStrategy, | ||
TextEncoderStream, | ||
TextDecoderStream | ||
} |