@yume-chan/stream-extra 2.5.3 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/LICENSE +1 -1
  2. package/esm/buffered-transform.d.ts +2 -2
  3. package/esm/buffered-transform.d.ts.map +1 -1
  4. package/esm/buffered-transform.js +1 -1
  5. package/esm/buffered-transform.js.map +1 -1
  6. package/esm/buffered.d.ts +1 -1
  7. package/esm/buffered.d.ts.map +1 -1
  8. package/esm/buffered.js.map +1 -1
  9. package/esm/concat.d.ts +25 -16
  10. package/esm/concat.d.ts.map +1 -1
  11. package/esm/concat.js +124 -93
  12. package/esm/concat.js.map +1 -1
  13. package/esm/consumable/readable.d.ts +2 -2
  14. package/esm/consumable/readable.d.ts.map +1 -1
  15. package/esm/consumable/readable.js +1 -1
  16. package/esm/consumable/readable.js.map +1 -1
  17. package/esm/consumable/wrap-byte-readable.d.ts +5 -2
  18. package/esm/consumable/wrap-byte-readable.d.ts.map +1 -1
  19. package/esm/consumable/wrap-byte-readable.js +12 -6
  20. package/esm/consumable/wrap-byte-readable.js.map +1 -1
  21. package/esm/consumable/wrap-writable.d.ts +1 -1
  22. package/esm/consumable/wrap-writable.d.ts.map +1 -1
  23. package/esm/consumable/wrap-writable.js +1 -1
  24. package/esm/consumable/wrap-writable.js.map +1 -1
  25. package/esm/consumable/writable.d.ts +2 -2
  26. package/esm/consumable/writable.d.ts.map +1 -1
  27. package/esm/consumable/writable.js +1 -1
  28. package/esm/consumable/writable.js.map +1 -1
  29. package/esm/consumable.d.ts +4 -0
  30. package/esm/consumable.d.ts.map +1 -1
  31. package/esm/consumable.js +5 -0
  32. package/esm/consumable.js.map +1 -1
  33. package/esm/distribution.d.ts +1 -1
  34. package/esm/distribution.d.ts.map +1 -1
  35. package/esm/distribution.js +1 -1
  36. package/esm/distribution.js.map +1 -1
  37. package/esm/duplex.d.ts +2 -2
  38. package/esm/duplex.d.ts.map +1 -1
  39. package/esm/duplex.js +1 -1
  40. package/esm/duplex.js.map +1 -1
  41. package/esm/global/abort-signal.d.ts +87 -0
  42. package/esm/global/abort-signal.d.ts.map +1 -0
  43. package/esm/global/abort-signal.js +4 -0
  44. package/esm/global/abort-signal.js.map +1 -0
  45. package/esm/global/compression.d.ts +15 -0
  46. package/esm/global/compression.d.ts.map +1 -0
  47. package/esm/global/compression.js +4 -0
  48. package/esm/global/compression.js.map +1 -0
  49. package/esm/global/encoding.d.ts +25 -0
  50. package/esm/global/encoding.d.ts.map +1 -0
  51. package/esm/global/encoding.js +4 -0
  52. package/esm/global/encoding.js.map +1 -0
  53. package/esm/global/event.d.ts +191 -0
  54. package/esm/global/event.d.ts.map +1 -0
  55. package/esm/global/event.js +4 -0
  56. package/esm/global/event.js.map +1 -0
  57. package/esm/global/index.d.ts +7 -0
  58. package/esm/global/index.d.ts.map +1 -0
  59. package/esm/global/index.js +7 -0
  60. package/esm/global/index.js.map +1 -0
  61. package/esm/{types.d.ts → global/streams.d.ts} +136 -222
  62. package/esm/global/streams.d.ts.map +1 -0
  63. package/esm/{stream.js → global/streams.js} +16 -8
  64. package/esm/global/streams.js.map +1 -0
  65. package/esm/global/timer.d.ts +13 -0
  66. package/esm/global/timer.d.ts.map +1 -0
  67. package/esm/global/timer.js +4 -0
  68. package/esm/global/timer.js.map +1 -0
  69. package/esm/global/utils.d.ts +9 -0
  70. package/esm/global/utils.d.ts.map +1 -0
  71. package/esm/global/utils.js +5 -0
  72. package/esm/global/utils.js.map +1 -0
  73. package/esm/index.d.ts +2 -2
  74. package/esm/index.d.ts.map +1 -1
  75. package/esm/index.js +2 -2
  76. package/esm/index.js.map +1 -1
  77. package/esm/inspect.d.ts +6 -2
  78. package/esm/inspect.d.ts.map +1 -1
  79. package/esm/inspect.js +10 -4
  80. package/esm/inspect.js.map +1 -1
  81. package/esm/maybe-consumable/wrap-writable.d.ts +1 -1
  82. package/esm/maybe-consumable/wrap-writable.d.ts.map +1 -1
  83. package/esm/maybe-consumable/wrap-writable.js +1 -1
  84. package/esm/maybe-consumable/wrap-writable.js.map +1 -1
  85. package/esm/maybe-consumable/writable.d.ts +2 -2
  86. package/esm/maybe-consumable/writable.d.ts.map +1 -1
  87. package/esm/maybe-consumable/writable.js +1 -1
  88. package/esm/maybe-consumable/writable.js.map +1 -1
  89. package/esm/pipe-from.d.ts +3 -3
  90. package/esm/pipe-from.d.ts.map +1 -1
  91. package/esm/pipe-from.js +1 -1
  92. package/esm/pipe-from.js.map +1 -1
  93. package/esm/push-readable.d.ts +20 -3
  94. package/esm/push-readable.d.ts.map +1 -1
  95. package/esm/push-readable.js +180 -180
  96. package/esm/push-readable.js.map +1 -1
  97. package/esm/split-string.d.ts +6 -2
  98. package/esm/split-string.d.ts.map +1 -1
  99. package/esm/split-string.js +28 -7
  100. package/esm/split-string.js.map +1 -1
  101. package/esm/struct-deserialize.js.map +1 -1
  102. package/esm/struct-serialize.d.ts +1 -1
  103. package/esm/struct-serialize.d.ts.map +1 -1
  104. package/esm/struct-serialize.js +1 -1
  105. package/esm/struct-serialize.js.map +1 -1
  106. package/esm/task-queue.d.ts +8 -0
  107. package/esm/task-queue.d.ts.map +1 -0
  108. package/esm/task-queue.js +50 -0
  109. package/esm/task-queue.js.map +1 -0
  110. package/esm/try-close.d.ts +3 -5
  111. package/esm/try-close.d.ts.map +1 -1
  112. package/esm/try-close.js.map +1 -1
  113. package/esm/wrap-readable.d.ts +2 -2
  114. package/esm/wrap-readable.d.ts.map +1 -1
  115. package/esm/wrap-readable.js +1 -1
  116. package/esm/wrap-readable.js.map +1 -1
  117. package/esm/wrap-writable.d.ts +2 -2
  118. package/esm/wrap-writable.d.ts.map +1 -1
  119. package/esm/wrap-writable.js +1 -1
  120. package/esm/wrap-writable.js.map +1 -1
  121. package/package.json +8 -8
  122. package/src/buffered-transform.ts +8 -7
  123. package/src/buffered.ts +4 -1
  124. package/src/concat.ts +161 -118
  125. package/src/consumable/readable.ts +2 -2
  126. package/src/consumable/wrap-byte-readable.ts +20 -7
  127. package/src/consumable/wrap-writable.ts +1 -1
  128. package/src/consumable/writable.ts +2 -2
  129. package/src/consumable.ts +8 -0
  130. package/src/distribution.ts +1 -1
  131. package/src/duplex.ts +2 -2
  132. package/src/global/abort-signal.ts +129 -0
  133. package/src/global/compression.ts +28 -0
  134. package/src/global/encoding.ts +36 -0
  135. package/src/global/event.ts +221 -0
  136. package/src/global/index.ts +6 -0
  137. package/src/{types.ts → global/streams.ts} +266 -244
  138. package/src/global/timer.ts +18 -0
  139. package/src/global/utils.ts +14 -0
  140. package/src/index.ts +2 -2
  141. package/src/inspect.ts +18 -4
  142. package/src/maybe-consumable/wrap-writable.ts +1 -1
  143. package/src/maybe-consumable/writable.ts +3 -3
  144. package/src/pipe-from.ts +2 -2
  145. package/src/push-readable.ts +226 -198
  146. package/src/split-string.ts +41 -7
  147. package/src/struct-deserialize.ts +1 -1
  148. package/src/struct-serialize.ts +1 -1
  149. package/src/task-queue.ts +69 -0
  150. package/src/try-close.ts +0 -12
  151. package/src/wrap-readable.ts +2 -2
  152. package/src/wrap-writable.ts +5 -2
  153. package/tsconfig.build.json +1 -6
  154. package/CHANGELOG.md +0 -102
  155. package/esm/encoding.d.ts +0 -21
  156. package/esm/encoding.d.ts.map +0 -1
  157. package/esm/encoding.js +0 -4
  158. package/esm/encoding.js.map +0 -1
  159. package/esm/stream.d.ts +0 -25
  160. package/esm/stream.d.ts.map +0 -1
  161. package/esm/stream.js.map +0 -1
  162. package/esm/types.d.ts.map +0 -1
  163. package/esm/types.js +0 -3
  164. package/esm/types.js.map +0 -1
  165. package/src/encoding.ts +0 -39
  166. package/src/stream.ts +0 -106
  167. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,137 +1,106 @@
1
- /**
2
- * A signal object that allows you to communicate with a request and abort it if required
3
- * via its associated `AbortController` object.
4
- *
5
- * @remarks
6
- * This interface is compatible with the `AbortSignal` interface defined in TypeScript's DOM types.
7
- * It is redefined here, so it can be polyfilled without a DOM, for example with
8
- * {@link https://www.npmjs.com/package/abortcontroller-polyfill | abortcontroller-polyfill} in a Node environment.
9
- *
10
- * @public
11
- */
12
- export declare interface AbortSignal {
13
- /**
14
- * Whether the request is aborted.
15
- */
16
- readonly aborted: boolean;
17
- /**
18
- * If aborted, returns the reason for aborting.
19
- */
20
- readonly reason?: unknown;
21
- /**
22
- * Add an event listener to be triggered when this signal becomes aborted.
23
- */
24
- addEventListener(type: "abort", listener: () => void): void;
25
- /**
26
- * Remove an event listener that was previously added with {@link AbortSignal.addEventListener}.
27
- */
28
- removeEventListener(type: "abort", listener: () => void): void;
29
- throwIfAborted(): void;
1
+ import type { AbortSignal } from "./abort-signal.js";
2
+ import type { GlobalPrototypeOr, GlobalValueOr } from "./utils.js";
3
+ export interface QueuingStrategySize<T = unknown> {
4
+ (chunk: T): number;
30
5
  }
31
- /**
32
- * A queuing strategy that counts the number of bytes in each chunk.
33
- *
34
- * @public
35
- */
36
- export declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {
37
- constructor(options: QueuingStrategyInit);
38
- /**
39
- * Returns the high water mark provided to the constructor.
40
- */
41
- get highWaterMark(): number;
42
- /**
43
- * Measures the size of `chunk` by returning the value of its `byteLength` property.
44
- */
45
- get size(): (chunk: ArrayBufferView) => number;
6
+ export interface QueuingStrategy<T = unknown> {
7
+ highWaterMark?: number;
8
+ size?: QueuingStrategySize<T>;
46
9
  }
47
10
  /**
48
- * A queuing strategy that counts the number of chunks.
11
+ * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.
49
12
  *
50
- * @public
13
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)
51
14
  */
52
- export declare class CountQueuingStrategy implements QueuingStrategy<unknown> {
53
- constructor(options: QueuingStrategyInit);
15
+ interface _ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
54
16
  /**
55
- * Returns the high water mark provided to the constructor.
17
+ * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.
18
+ *
19
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)
56
20
  */
57
- get highWaterMark(): number;
21
+ readonly highWaterMark: number;
22
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
23
+ readonly size: QueuingStrategySize<ArrayBufferView>;
24
+ }
25
+ export type ByteLengthQueuingStrategy = GlobalPrototypeOr<"ByteLengthQueuingStrategy", _ByteLengthQueuingStrategy>;
26
+ export interface QueuingStrategyInit {
58
27
  /**
59
- * Measures the size of `chunk` by always returning 1.
60
- * This ensures that the total queue size is a count of the number of chunks in the queue.
28
+ * Creates a new ByteLengthQueuingStrategy with the provided high water mark.
29
+ *
30
+ * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
61
31
  */
62
- get size(): (chunk: unknown) => 1;
32
+ highWaterMark: number;
33
+ }
34
+ interface _ByteLengthQueuingStrategyConstructor {
35
+ prototype: ByteLengthQueuingStrategy;
36
+ new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
63
37
  }
38
+ type ByteLengthQueuingStrategyConstructor = GlobalValueOr<"ByteLengthQueuingStrategy", _ByteLengthQueuingStrategyConstructor>;
39
+ export declare const ByteLengthQueuingStrategy: NonNullable<ByteLengthQueuingStrategyConstructor>;
64
40
  /**
65
- * A queuing strategy.
41
+ * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.
66
42
  *
67
- * @public
43
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
68
44
  */
69
- export declare interface QueuingStrategy<T> {
70
- /**
71
- * A non-negative number indicating the high water mark of the stream using this queuing strategy.
72
- */
73
- highWaterMark?: number;
45
+ interface _CountQueuingStrategy extends QueuingStrategy {
74
46
  /**
75
- * A function that computes and returns the finite non-negative size of the given chunk value.
47
+ * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.
48
+ *
49
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)
76
50
  */
77
- size?: QueuingStrategySizeCallback<T>;
51
+ readonly highWaterMark: number;
52
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
53
+ readonly size: QueuingStrategySize;
78
54
  }
79
- /**
80
- * @public
81
- */
82
- export declare interface QueuingStrategyInit {
83
- /**
84
- * {@inheritDoc QueuingStrategy.highWaterMark}
85
- */
86
- highWaterMark: number;
55
+ export type CountQueuingStrategy = GlobalPrototypeOr<"CountQueuingStrategy", _CountQueuingStrategy>;
56
+ interface _CountQueuingStrategyConstructor {
57
+ prototype: CountQueuingStrategy;
58
+ new (init: QueuingStrategyInit): CountQueuingStrategy;
87
59
  }
60
+ type CountQueuingStrategyConstructor = GlobalValueOr<"CountQueuingStrategy", _CountQueuingStrategyConstructor>;
61
+ export declare const CountQueuingStrategy: NonNullable<CountQueuingStrategyConstructor>;
88
62
  /**
89
- * {@inheritDoc QueuingStrategy.size}
90
- * @public
91
- */
92
- export declare type QueuingStrategySizeCallback<T> = (chunk: T) => number;
93
- /**
94
- * Allows control of a {@link ReadableStream | readable byte stream}'s state and internal queue.
63
+ * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. It allows control of the state and internal queue of a ReadableStream with an underlying byte source, and enables efficient zero-copy transfer of data from the underlying source to a consumer when the stream's internal queue is empty.
95
64
  *
96
- * @public
65
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
97
66
  */
98
- export declare class ReadableByteStreamController {
99
- private constructor();
67
+ interface _ReadableByteStreamController {
100
68
  /**
101
- * Returns the current BYOB pull request, or `null` if there isn't one.
69
+ * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
70
+ *
71
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)
102
72
  */
103
- get byobRequest(): ReadableStreamBYOBRequest | null;
73
+ readonly byobRequest: ReadableStreamBYOBRequest | null;
104
74
  /**
105
- * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
106
- * over-full. An underlying byte source ought to use this information to determine when and how to apply backpressure.
75
+ * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its "desired size".
76
+ *
77
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)
107
78
  */
108
- get desiredSize(): number | null;
79
+ readonly desiredSize: number | null;
109
80
  /**
110
- * Closes the controlled readable stream. Consumers will still be able to read any previously-enqueued chunks from
111
- * the stream, but once those are read, the stream will become closed.
81
+ * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.
82
+ *
83
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)
112
84
  */
113
85
  close(): void;
114
86
  /**
115
- * Enqueues the given chunk chunk in the controlled readable stream.
116
- * The chunk has to be an `ArrayBufferView` instance, or else a `TypeError` will be thrown.
87
+ * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is transferred into the stream's internal queues).
88
+ *
89
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
117
90
  */
118
- enqueue(chunk: ArrayBufferView): void;
91
+ enqueue(chunk: ArrayBufferView<ArrayBuffer>): void;
119
92
  /**
120
- * Errors the controlled readable stream, making all future interactions with it fail with the given error `e`.
93
+ * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.
94
+ *
95
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)
121
96
  */
122
97
  error(e?: unknown): void;
123
98
  }
99
+ export type ReadableByteStreamController = GlobalPrototypeOr<"ReadableByteStreamController", _ReadableByteStreamController>;
124
100
  /**
125
101
  * A readable stream represents a source of data, from which you can read.
126
- *
127
- * @public
128
102
  */
129
- export declare class ReadableStream<out R> implements AsyncIterable<R> {
130
- constructor(underlyingSource: UnderlyingByteSource, strategy?: {
131
- highWaterMark?: number;
132
- size?: undefined;
133
- });
134
- constructor(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>);
103
+ export interface ReadableStream<out R> extends AsyncIterable<R> {
135
104
  /**
136
105
  * Whether or not the readable stream is locked to a {@link ReadableStreamDefaultReader | reader}.
137
106
  */
@@ -206,35 +175,32 @@ export declare class ReadableStream<out R> implements AsyncIterable<R> {
206
175
  * cancel the stream. To prevent this, use the stream's {@link ReadableStream.values | values()} method, passing
207
176
  * `true` for the `preventCancel` option.
208
177
  */
209
- values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
178
+ values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>;
210
179
  /**
211
180
  * {@inheritDoc ReadableStream.values}
212
181
  */
213
- [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
182
+ [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>;
183
+ }
184
+ interface ReadableStreamConstructor {
185
+ prototype: ReadableStream<unknown>;
186
+ new <R = Uint8Array<ArrayBuffer>>(underlyingSource: UnderlyingByteSource, strategy?: {
187
+ highWaterMark?: number;
188
+ size?: undefined;
189
+ }): ReadableStream<R>;
190
+ new <R>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
214
191
  /**
215
192
  * Creates a new ReadableStream wrapping the provided iterable or async iterable.
216
193
  *
217
194
  * This can be used to adapt various kinds of objects into a readable stream,
218
195
  * such as an array, an async generator, or a Node.js readable stream.
219
196
  */
220
- static from<R>(asyncIterable: Iterable<R> | AsyncIterable<R>): ReadableStream<R>;
221
- }
222
- /**
223
- * An async iterator returned by {@link ReadableStream.values}.
224
- *
225
- * @public
226
- */
227
- export declare interface ReadableStreamAsyncIterator<R> extends AsyncIterableIterator<R> {
228
- next(): Promise<IteratorResult<R, void>>;
229
- return(value?: R): Promise<IteratorResult<R>>;
197
+ from<R>(asyncIterable: Iterable<R> | AsyncIterable<R>): ReadableStream<R>;
230
198
  }
199
+ export declare const ReadableStream: ReadableStreamConstructor;
231
200
  /**
232
201
  * A BYOB reader vended by a {@link ReadableStream}.
233
- *
234
- * @public
235
202
  */
236
- export declare class ReadableStreamBYOBReader {
237
- constructor(stream: ReadableStream<Uint8Array>);
203
+ export interface ReadableStreamBYOBReader {
238
204
  /**
239
205
  * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
240
206
  * the reader's lock is released before the stream finishes closing.
@@ -261,19 +227,20 @@ export declare class ReadableStreamBYOBReader {
261
227
  */
262
228
  releaseLock(): void;
263
229
  }
230
+ interface ReadableStreamBYOBReaderConstructor {
231
+ prototype: ReadableStreamBYOBReader;
232
+ new (stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
233
+ }
234
+ export declare const ReadableStreamBYOBReader: ReadableStreamBYOBReaderConstructor;
264
235
  /**
265
236
  * Options for {@link ReadableStreamBYOBReader.read | reading} a stream
266
237
  * with a {@link ReadableStreamBYOBReader | BYOB reader}.
267
- *
268
- * @public
269
238
  */
270
- export declare interface ReadableStreamBYOBReaderReadOptions {
239
+ export interface ReadableStreamBYOBReaderReadOptions {
271
240
  min?: number | undefined;
272
241
  }
273
242
  /**
274
243
  * A result returned by {@link ReadableStreamBYOBReader.read}.
275
- *
276
- * @public
277
244
  */
278
245
  export declare type ReadableStreamBYOBReadResult<T extends ArrayBufferView> = {
279
246
  done: false;
@@ -284,11 +251,8 @@ export declare type ReadableStreamBYOBReadResult<T extends ArrayBufferView> = {
284
251
  };
285
252
  /**
286
253
  * A pull-into request in a {@link ReadableByteStreamController}.
287
- *
288
- * @public
289
254
  */
290
- export declare class ReadableStreamBYOBRequest {
291
- private constructor();
255
+ export interface ReadableStreamBYOBRequest {
292
256
  /**
293
257
  * Returns the view for writing in to, or `null` if the BYOB request has already been responded to.
294
258
  */
@@ -312,11 +276,8 @@ export declare class ReadableStreamBYOBRequest {
312
276
  }
313
277
  /**
314
278
  * Allows control of a {@link ReadableStream | readable stream}'s state and internal queue.
315
- *
316
- * @public
317
279
  */
318
- export declare class ReadableStreamDefaultController<R> {
319
- private constructor();
280
+ export interface ReadableStreamDefaultController<R> {
320
281
  /**
321
282
  * Returns the desired size to fill the controlled stream's internal queue. It can be negative, if the queue is
322
283
  * over-full. An underlying source ought to use this information to determine when and how to apply backpressure.
@@ -338,11 +299,8 @@ export declare class ReadableStreamDefaultController<R> {
338
299
  }
339
300
  /**
340
301
  * A default reader vended by a {@link ReadableStream}.
341
- *
342
- * @public
343
302
  */
344
- export declare class ReadableStreamDefaultReader<out R> {
345
- constructor(stream: ReadableStream<R>);
303
+ export interface ReadableStreamDefaultReader<out R> {
346
304
  /**
347
305
  * Returns a promise that will be fulfilled when the stream becomes closed,
348
306
  * or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.
@@ -369,62 +327,39 @@ export declare class ReadableStreamDefaultReader<out R> {
369
327
  */
370
328
  releaseLock(): void;
371
329
  }
372
- /**
373
- * A common interface for a `ReadableStreamDefaultReader` implementation.
374
- *
375
- * @public
376
- */
377
- export declare interface ReadableStreamDefaultReaderLike<R> {
378
- readonly closed: Promise<undefined>;
379
- cancel(reason?: unknown): Promise<void>;
380
- read(): Promise<ReadableStreamDefaultReadResult<R>>;
381
- releaseLock(): void;
330
+ interface ReadableStreamDefaultReaderConstructor {
331
+ prototype: ReadableStreamDefaultReader<never>;
332
+ new <R>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
382
333
  }
334
+ export declare const ReadableStreamDefaultReader: ReadableStreamDefaultReaderConstructor;
383
335
  /**
384
336
  * A result returned by {@link ReadableStreamDefaultReader.read}.
385
- *
386
- * @public
387
337
  */
388
338
  export declare type ReadableStreamDefaultReadResult<T> = {
389
339
  done: false;
390
340
  value: T;
391
341
  } | {
392
342
  done: true;
393
- value?: undefined;
343
+ value: undefined;
394
344
  };
395
345
  /**
396
346
  * Options for {@link ReadableStream.values | async iterating} a stream.
397
- *
398
- * @public
399
347
  */
400
- export declare interface ReadableStreamIteratorOptions {
348
+ export interface ReadableStreamIteratorOptions {
401
349
  preventCancel?: boolean;
402
350
  }
403
- /**
404
- * A common interface for a `ReadableStream` implementation.
405
- *
406
- * @public
407
- */
408
- export declare interface ReadableStreamLike<R> {
409
- readonly locked: boolean;
410
- getReader(): ReadableStreamDefaultReaderLike<R>;
411
- }
412
351
  /**
413
352
  * A pair of a {@link ReadableStream | readable stream} and {@link WritableStream | writable stream} that can be passed
414
353
  * to {@link ReadableStream.pipeThrough}.
415
- *
416
- * @public
417
354
  */
418
- export declare interface ReadableWritablePair<R, W> {
355
+ export interface ReadableWritablePair<R, W> {
419
356
  readable: ReadableStream<R>;
420
357
  writable: WritableStream<W>;
421
358
  }
422
359
  /**
423
360
  * Options for {@link ReadableStream.pipeTo | piping} a stream.
424
- *
425
- * @public
426
361
  */
427
- export declare interface StreamPipeOptions {
362
+ export interface StreamPipeOptions {
428
363
  /**
429
364
  * If set to true, {@link ReadableStream.pipeTo} will not abort the writable stream if the readable stream errors.
430
365
  */
@@ -443,14 +378,12 @@ export declare interface StreamPipeOptions {
443
378
  * `AbortController`. In this case, the source readable stream will be canceled, and the destination writable stream
444
379
  * aborted, unless the respective options `preventCancel` or `preventAbort` are set.
445
380
  */
446
- signal?: AbortSignal;
381
+ signal?: AbortSignal | undefined;
447
382
  }
448
383
  /**
449
384
  * A transformer for constructing a {@link TransformStream}.
450
- *
451
- * @public
452
385
  */
453
- export declare interface Transformer<I, O> {
386
+ export interface Transformer<I, O> {
454
387
  /**
455
388
  * A function that is called immediately during creation of the {@link TransformStream}.
456
389
  */
@@ -471,24 +404,17 @@ export declare interface Transformer<I, O> {
471
404
  readableType?: undefined;
472
405
  writableType?: undefined;
473
406
  }
474
- /** @public */
475
- export declare type TransformerCancelCallback = (reason: unknown) => void | PromiseLike<void>;
476
- /** @public */
477
- export declare type TransformerFlushCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
478
- /** @public */
479
- export declare type TransformerStartCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
480
- /** @public */
481
- export declare type TransformerTransformCallback<I, O> = (chunk: I, controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
407
+ export type TransformerCancelCallback = (reason: unknown) => void | PromiseLike<void>;
408
+ export type TransformerFlushCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
409
+ export type TransformerStartCallback<O> = (controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
410
+ export type TransformerTransformCallback<I, O> = (chunk: I, controller: TransformStreamDefaultController<O>) => void | PromiseLike<void>;
482
411
  /**
483
412
  * A transform stream consists of a pair of streams: a {@link WritableStream | writable stream},
484
413
  * known as its writable side, and a {@link ReadableStream | readable stream}, known as its readable side.
485
414
  * In a manner specific to the transform stream in question, writes to the writable side result in new data being
486
415
  * made available for reading from the readable side.
487
- *
488
- * @public
489
416
  */
490
- export declare class TransformStream<I, O> {
491
- constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
417
+ export interface TransformStream<I, O> {
492
418
  /**
493
419
  * The readable side of the transform stream.
494
420
  */
@@ -498,13 +424,15 @@ export declare class TransformStream<I, O> {
498
424
  */
499
425
  get writable(): WritableStream<I>;
500
426
  }
427
+ interface TransformStreamConstructor {
428
+ prototype: TransformStream<never, unknown>;
429
+ new <I, O>(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>): TransformStream<I, O>;
430
+ }
431
+ export declare const TransformStream: TransformStreamConstructor;
501
432
  /**
502
433
  * Allows control of the {@link ReadableStream} and {@link WritableStream} of the associated {@link TransformStream}.
503
- *
504
- * @public
505
434
  */
506
- export declare class TransformStreamDefaultController<O> {
507
- private constructor();
435
+ export interface TransformStreamDefaultController<O> {
508
436
  /**
509
437
  * Returns the desired size to fill the readable side’s internal queue. It can be negative, if the queue is over-full.
510
438
  */
@@ -526,10 +454,8 @@ export declare class TransformStreamDefaultController<O> {
526
454
  }
527
455
  /**
528
456
  * An underlying byte source for constructing a {@link ReadableStream}.
529
- *
530
- * @public
531
457
  */
532
- export declare interface UnderlyingByteSource {
458
+ export interface UnderlyingByteSource {
533
459
  /**
534
460
  * {@inheritDoc UnderlyingSource.start}
535
461
  */
@@ -559,16 +485,12 @@ export declare interface UnderlyingByteSource {
559
485
  */
560
486
  autoAllocateChunkSize?: number;
561
487
  }
562
- /** @public */
563
- export declare type UnderlyingByteSourcePullCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
564
- /** @public */
565
- export declare type UnderlyingByteSourceStartCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
488
+ export type UnderlyingByteSourcePullCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
489
+ export type UnderlyingByteSourceStartCallback = (controller: ReadableByteStreamController) => void | PromiseLike<void>;
566
490
  /**
567
491
  * An underlying sink for constructing a {@link WritableStream}.
568
- *
569
- * @public
570
492
  */
571
- export declare interface UnderlyingSink<in W> {
493
+ export interface UnderlyingSink<in W> {
572
494
  /**
573
495
  * A function that is called immediately during creation of the {@link WritableStream}.
574
496
  */
@@ -606,20 +528,14 @@ export declare interface UnderlyingSink<in W> {
606
528
  abort?: UnderlyingSinkAbortCallback;
607
529
  type?: undefined;
608
530
  }
609
- /** @public */
610
- export declare type UnderlyingSinkAbortCallback = (reason: unknown) => void | PromiseLike<void>;
611
- /** @public */
612
- export declare type UnderlyingSinkCloseCallback = () => void | PromiseLike<void>;
613
- /** @public */
614
- export declare type UnderlyingSinkStartCallback = (controller: WritableStreamDefaultController) => void | PromiseLike<void>;
615
- /** @public */
616
- export declare type UnderlyingSinkWriteCallback<W> = (chunk: W, controller: WritableStreamDefaultController) => void | PromiseLike<void>;
531
+ export type UnderlyingSinkAbortCallback = (reason: unknown) => void | PromiseLike<void>;
532
+ export type UnderlyingSinkCloseCallback = () => void | PromiseLike<void>;
533
+ export type UnderlyingSinkStartCallback = (controller: WritableStreamDefaultController) => void | PromiseLike<void>;
534
+ export type UnderlyingSinkWriteCallback<W> = (chunk: W, controller: WritableStreamDefaultController) => void | PromiseLike<void>;
617
535
  /**
618
536
  * An underlying source for constructing a {@link ReadableStream}.
619
- *
620
- * @public
621
537
  */
622
- export declare interface UnderlyingSource<R> {
538
+ export interface UnderlyingSource<R> {
623
539
  /**
624
540
  * A function that is called immediately during creation of the {@link ReadableStream}.
625
541
  */
@@ -640,19 +556,13 @@ export declare interface UnderlyingSource<R> {
640
556
  cancel?: UnderlyingSourceCancelCallback;
641
557
  type?: undefined;
642
558
  }
643
- /** @public */
644
- export declare type UnderlyingSourceCancelCallback = (reason: unknown) => void | PromiseLike<void>;
645
- /** @public */
646
- export declare type UnderlyingSourcePullCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
647
- /** @public */
648
- export declare type UnderlyingSourceStartCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
559
+ export type UnderlyingSourceCancelCallback = (reason: unknown) => void | PromiseLike<void>;
560
+ export type UnderlyingSourcePullCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
561
+ export type UnderlyingSourceStartCallback<R> = (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
649
562
  /**
650
563
  * A writable stream represents a destination for data, into which you can write.
651
- *
652
- * @public
653
564
  */
654
- export declare class WritableStream<in W> {
655
- constructor(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>);
565
+ export interface WritableStream<in W> {
656
566
  /**
657
567
  * Returns whether or not the writable stream is locked to a writer.
658
568
  */
@@ -686,13 +596,15 @@ export declare class WritableStream<in W> {
686
596
  */
687
597
  getWriter(): WritableStreamDefaultWriter<W>;
688
598
  }
599
+ interface WritableStreamConstructor {
600
+ prototype: WritableStream<never>;
601
+ new <W>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
602
+ }
603
+ export declare const WritableStream: WritableStreamConstructor;
689
604
  /**
690
605
  * Allows control of a {@link WritableStream | writable stream}'s state and internal queue.
691
- *
692
- * @public
693
606
  */
694
- export declare class WritableStreamDefaultController {
695
- private constructor();
607
+ export interface WritableStreamDefaultController {
696
608
  /**
697
609
  * The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
698
610
  *
@@ -716,11 +628,8 @@ export declare class WritableStreamDefaultController {
716
628
  }
717
629
  /**
718
630
  * A default writer vended by a {@link WritableStream}.
719
- *
720
- * @public
721
631
  */
722
- export declare class WritableStreamDefaultWriter<in W> {
723
- constructor(stream: WritableStream<W>);
632
+ export interface WritableStreamDefaultWriter<in W> {
724
633
  /**
725
634
  * Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or
726
635
  * the writer’s lock is released before the stream finishes closing.
@@ -774,5 +683,10 @@ export declare class WritableStreamDefaultWriter<in W> {
774
683
  */
775
684
  write(chunk: W): Promise<void>;
776
685
  }
686
+ interface WritableStreamDefaultWriterConstructor {
687
+ prototype: WritableStreamDefaultWriter<never>;
688
+ new <W>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
689
+ }
690
+ export declare const WritableStreamDefaultWriter: WritableStreamDefaultWriterConstructor;
777
691
  export {};
778
- //# sourceMappingURL=types.d.ts.map
692
+ //# sourceMappingURL=streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/global/streams.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,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AI,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC;;;;;;;OAOG;IACH,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAAC;IACjC;;;;;;;OAOG;IACH,IAAI,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;;;;;OASG;IACH,WAAW,IAAI,IAAI,CAAC;IACpB;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,UAAU,sCAAsC;IAC5C,SAAS,EAAE,2BAA2B,CAAC,KAAK,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,2BAA2B,CAAC,CAAC,CAAC,CAAC;CACtE;AAED,eAAO,MAAM,2BAA2B,wCAGnC,CAAC"}
@@ -1,8 +1,11 @@
1
- export * from "./types.js";
2
- export { ReadableStream };
3
- export const { AbortController } = globalThis;
4
- const ReadableStream = /* #__PURE__ */ (() => {
5
- const { ReadableStream } = globalThis;
1
+ /// <reference lib="es2018.asynciterable" />
2
+ import { tryCancel } from "../try-close.js";
3
+ import { getGlobalValue } from "./utils.js";
4
+ export const ByteLengthQueuingStrategy = getGlobalValue("ByteLengthQueuingStrategy");
5
+ export const CountQueuingStrategy = getGlobalValue("CountQueuingStrategy");
6
+ export const ReadableStream = /* #__PURE__ */ (() => {
7
+ const ReadableStream = getGlobalValue("ReadableStream");
8
+ /* node:coverage disable */
6
9
  if (!ReadableStream.from) {
7
10
  ReadableStream.from = function (iterable) {
8
11
  const iterator = Symbol.asyncIterator in iterable
@@ -41,7 +44,7 @@ const ReadableStream = /* #__PURE__ */ (() => {
41
44
  // We don't need to care about the parameter to `iterator.return`,
42
45
  // it will be returned as the final `result.value` automatically.
43
46
  if (!options?.preventCancel) {
44
- await reader.cancel();
47
+ await tryCancel(reader);
45
48
  }
46
49
  reader.releaseLock();
47
50
  }
@@ -50,7 +53,12 @@ const ReadableStream = /* #__PURE__ */ (() => {
50
53
  // eslint-disable-next-line @typescript-eslint/unbound-method
51
54
  ReadableStream.prototype.values;
52
55
  }
56
+ /* node:coverage enable */
53
57
  return ReadableStream;
54
58
  })();
55
- export const { WritableStream, TransformStream } = globalThis;
56
- //# sourceMappingURL=stream.js.map
59
+ export const ReadableStreamBYOBReader = getGlobalValue("ReadableStreamBYOBReader");
60
+ export const ReadableStreamDefaultReader = getGlobalValue("ReadableStreamDefaultReader");
61
+ export const TransformStream = getGlobalValue("TransformStream");
62
+ export const WritableStream = getGlobalValue("WritableStream");
63
+ export const WritableStreamDefaultWriter = getGlobalValue("WritableStreamDefaultWriter");
64
+ //# sourceMappingURL=streams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.js","sourceRoot":"","sources":["../../src/global/streams.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmD5C,MAAM,CAAC,MAAM,yBAAyB,GAClC,cAAc,CACV,2BAA2B,CAC9B,CAAC;AAiCN,MAAM,CAAC,MAAM,oBAAoB,GAC7B,cAAc,CAAkC,sBAAsB,CAAC,CAAC;AAgK5E,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IAChD,MAAM,cAAc,GAChB,cAAc,CAA4B,gBAAgB,CAAC,CAAC;IAEhE,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QACvB,cAAc,CAAC,IAAI,GAAG,UAAU,QAAQ;YACpC,MAAM,QAAQ,GACV,MAAM,CAAC,aAAa,IAAI,QAAQ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