@yume-chan/stream-extra 0.0.23 → 1.0.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.
- package/CHANGELOG.md +32 -2
- package/LICENSE +1 -1
- package/esm/buffered-transform.d.ts +3 -3
- package/esm/buffered-transform.d.ts.map +1 -1
- package/esm/buffered-transform.js.map +1 -1
- package/esm/buffered.d.ts +3 -6
- package/esm/buffered.d.ts.map +1 -1
- package/esm/buffered.js +87 -75
- package/esm/buffered.js.map +1 -1
- package/esm/concat.d.ts +4 -3
- package/esm/concat.d.ts.map +1 -1
- package/esm/concat.js +6 -4
- package/esm/concat.js.map +1 -1
- package/esm/consumable.d.ts +36 -43
- package/esm/consumable.d.ts.map +1 -1
- package/esm/consumable.js +74 -125
- package/esm/consumable.js.map +1 -1
- package/esm/distribution.d.ts +3 -2
- package/esm/distribution.d.ts.map +1 -1
- package/esm/distribution.js +22 -18
- package/esm/distribution.js.map +1 -1
- package/esm/duplex.d.ts +2 -2
- package/esm/duplex.d.ts.map +1 -1
- package/esm/duplex.js +2 -6
- package/esm/duplex.js.map +1 -1
- package/esm/encoding.d.ts +21 -0
- package/esm/encoding.d.ts.map +1 -0
- package/esm/encoding.js +4 -0
- package/esm/encoding.js.map +1 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -1
- package/esm/index.js.map +1 -1
- package/esm/maybe-consumable-ns.d.ts +16 -0
- package/esm/maybe-consumable-ns.d.ts.map +1 -0
- package/esm/maybe-consumable-ns.js +44 -0
- package/esm/maybe-consumable-ns.js.map +1 -0
- package/esm/maybe-consumable.d.ts +4 -0
- package/esm/maybe-consumable.d.ts.map +1 -0
- package/esm/maybe-consumable.js +2 -0
- package/esm/maybe-consumable.js.map +1 -0
- package/esm/push-readable.d.ts +16 -2
- package/esm/push-readable.d.ts.map +1 -1
- package/esm/push-readable.js +176 -17
- package/esm/push-readable.js.map +1 -1
- package/esm/stream.d.ts +7 -7
- package/esm/stream.d.ts.map +1 -1
- package/esm/stream.js +54 -5
- package/esm/stream.js.map +1 -1
- package/esm/struct-deserialize.d.ts +3 -4
- package/esm/struct-deserialize.d.ts.map +1 -1
- package/esm/struct-deserialize.js.map +1 -1
- package/esm/struct-serialize.d.ts +2 -2
- package/esm/struct-serialize.d.ts.map +1 -1
- package/esm/struct-serialize.js.map +1 -1
- package/esm/task.d.ts +5 -0
- package/esm/task.d.ts.map +1 -0
- package/esm/task.js +9 -0
- package/esm/task.js.map +1 -0
- package/esm/try-close.d.ts +10 -0
- package/esm/try-close.d.ts.map +1 -0
- package/esm/try-close.js +19 -0
- package/esm/try-close.js.map +1 -0
- package/esm/types.d.ts +34 -35
- package/esm/types.d.ts.map +1 -1
- package/esm/wrap-readable.d.ts +5 -4
- package/esm/wrap-readable.d.ts.map +1 -1
- package/esm/wrap-readable.js +14 -9
- package/esm/wrap-readable.js.map +1 -1
- package/esm/wrap-writable.d.ts +2 -2
- package/esm/wrap-writable.d.ts.map +1 -1
- package/esm/wrap-writable.js +4 -6
- package/esm/wrap-writable.js.map +1 -1
- package/package.json +11 -15
- package/src/buffered-transform.ts +2 -2
- package/src/buffered.ts +107 -83
- package/src/concat.ts +6 -4
- package/src/consumable.ts +132 -213
- package/src/distribution.ts +30 -20
- package/src/duplex.ts +4 -7
- package/src/encoding.ts +39 -0
- package/src/index.ts +4 -1
- package/src/maybe-consumable-ns.ts +75 -0
- package/src/maybe-consumable.ts +5 -0
- package/src/push-readable.ts +213 -19
- package/src/stream.ts +69 -9
- package/src/struct-deserialize.ts +4 -7
- package/src/struct-serialize.ts +3 -3
- package/src/task.ts +21 -0
- package/src/try-close.ts +44 -0
- package/src/types.ts +34 -34
- package/src/wrap-readable.ts +20 -14
- package/src/wrap-writable.ts +6 -9
- package/tsconfig.build.tsbuildinfo +1 -1
- package/CHANGELOG.json +0 -86
- package/esm/decode-utf8.d.ts +0 -5
- package/esm/decode-utf8.d.ts.map +0 -1
- package/esm/decode-utf8.js +0 -12
- package/esm/decode-utf8.js.map +0 -1
- package/src/decode-utf8.ts +0 -13
package/esm/push-readable.d.ts
CHANGED
|
@@ -7,8 +7,22 @@ export interface PushReadableStreamController<T> {
|
|
|
7
7
|
error(e?: unknown): void;
|
|
8
8
|
}
|
|
9
9
|
export type PushReadableStreamSource<T> = (controller: PushReadableStreamController<T>) => void | Promise<void>;
|
|
10
|
+
export type PushReadableLogger<T> = (event: {
|
|
11
|
+
source: "producer";
|
|
12
|
+
operation: "enqueue";
|
|
13
|
+
value: T;
|
|
14
|
+
phase: "start" | "waiting" | "ignored" | "complete";
|
|
15
|
+
} | {
|
|
16
|
+
source: "producer";
|
|
17
|
+
operation: "close" | "error";
|
|
18
|
+
explicit: boolean;
|
|
19
|
+
phase: "start" | "ignored" | "complete";
|
|
20
|
+
} | {
|
|
21
|
+
source: "consumer";
|
|
22
|
+
operation: "pull" | "cancel";
|
|
23
|
+
phase: "start" | "complete";
|
|
24
|
+
}) => void;
|
|
10
25
|
export declare class PushReadableStream<T> extends ReadableStream<T> {
|
|
11
|
-
#private;
|
|
12
26
|
/**
|
|
13
27
|
* Create a new `PushReadableStream` from a source.
|
|
14
28
|
*
|
|
@@ -16,6 +30,6 @@ export declare class PushReadableStream<T> extends ReadableStream<T> {
|
|
|
16
30
|
* when the `Promise` is resolved, and be errored when the `Promise` is rejected.
|
|
17
31
|
* @param strategy
|
|
18
32
|
*/
|
|
19
|
-
constructor(source: PushReadableStreamSource<T>, strategy?: QueuingStrategy<T>);
|
|
33
|
+
constructor(source: PushReadableStreamSource<T>, strategy?: QueuingStrategy<T>, logger?: PushReadableLogger<T>);
|
|
20
34
|
}
|
|
21
35
|
//# sourceMappingURL=push-readable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-readable.d.ts","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAA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AAC;IACT,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;CACvD,GACD;IACI,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;CAC3C,GACD;IACI,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,KAAK,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,KACN,IAAI,CAAC;AAEV,qBAAa,kBAAkB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IACxD;;;;;;OAMG;gBAEC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACnC,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;CA+PrC"}
|
package/esm/push-readable.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PromiseResolver } from "@yume-chan/async";
|
|
2
2
|
import { AbortController, ReadableStream } from "./stream.js";
|
|
3
3
|
export class PushReadableStream extends ReadableStream {
|
|
4
|
-
#zeroHighWaterMarkAllowEnqueue = false;
|
|
5
4
|
/**
|
|
6
5
|
* Create a new `PushReadableStream` from a source.
|
|
7
6
|
*
|
|
@@ -9,71 +8,231 @@ export class PushReadableStream extends ReadableStream {
|
|
|
9
8
|
* when the `Promise` is resolved, and be errored when the `Promise` is rejected.
|
|
10
9
|
* @param strategy
|
|
11
10
|
*/
|
|
12
|
-
constructor(source, strategy) {
|
|
11
|
+
constructor(source, strategy, logger) {
|
|
13
12
|
let waterMarkLow;
|
|
13
|
+
let zeroHighWaterMarkAllowEnqueue = false;
|
|
14
14
|
const abortController = new AbortController();
|
|
15
15
|
super({
|
|
16
|
-
start:
|
|
17
|
-
await Promise.resolve();
|
|
16
|
+
start: (controller) => {
|
|
18
17
|
const result = source({
|
|
19
18
|
abortSignal: abortController.signal,
|
|
20
19
|
enqueue: async (chunk) => {
|
|
20
|
+
logger?.({
|
|
21
|
+
source: "producer",
|
|
22
|
+
operation: "enqueue",
|
|
23
|
+
value: chunk,
|
|
24
|
+
phase: "start",
|
|
25
|
+
});
|
|
21
26
|
if (abortController.signal.aborted) {
|
|
22
|
-
//
|
|
23
|
-
// throw
|
|
24
|
-
|
|
27
|
+
// In original `ReadableStream`, calling `enqueue` or `close`
|
|
28
|
+
// on an cancelled stream will throw an error,
|
|
29
|
+
//
|
|
30
|
+
// But in `PushReadableStream`, `enqueue` is an async function,
|
|
31
|
+
// the producer can't just check `abortSignal.aborted`
|
|
32
|
+
// before calling `enqueue`, as it might change when waiting
|
|
33
|
+
// for the backpressure to be reduced.
|
|
34
|
+
//
|
|
35
|
+
// So IMO it's better to handle this for the producer
|
|
36
|
+
// by simply ignoring the `enqueue` call.
|
|
37
|
+
//
|
|
38
|
+
// Note that we check `abortSignal.aborted` instead of `stopped`,
|
|
39
|
+
// as it's not allowed for the producer to call `enqueue` after
|
|
40
|
+
// they called `close` or `error`.
|
|
41
|
+
//
|
|
42
|
+
// Obviously, the producer should listen to the `abortSignal` and
|
|
43
|
+
// stop producing, but most pushing data sources don't support that.
|
|
44
|
+
logger?.({
|
|
45
|
+
source: "producer",
|
|
46
|
+
operation: "enqueue",
|
|
47
|
+
value: chunk,
|
|
48
|
+
phase: "ignored",
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
25
51
|
}
|
|
26
52
|
if (controller.desiredSize === null) {
|
|
27
53
|
// `desiredSize` being `null` means the stream is in error state,
|
|
28
54
|
// `controller.enqueue` will throw an error for us.
|
|
29
55
|
controller.enqueue(chunk);
|
|
56
|
+
// istanbul ignore next
|
|
30
57
|
return;
|
|
31
58
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
59
|
+
if (zeroHighWaterMarkAllowEnqueue) {
|
|
60
|
+
// When `highWaterMark` is set to `0`,
|
|
61
|
+
// `controller.desiredSize` will always be `0`,
|
|
62
|
+
// even if the consumer has called `reader.read()`.
|
|
63
|
+
// (in this case, each `reader.read()`/`pull`
|
|
64
|
+
// should allow one `enqueue` of any size)
|
|
65
|
+
//
|
|
66
|
+
// If the consumer has already called `reader.read()`,
|
|
67
|
+
// before the producer tries to `enqueue`,
|
|
68
|
+
// `controller.desiredSize` is `0` and normal `waterMarkLow` signal
|
|
69
|
+
// will never trigger,
|
|
70
|
+
// (because `ReadableStream` prevents reentrance of `pull`)
|
|
71
|
+
// The stream will stuck.
|
|
72
|
+
//
|
|
73
|
+
// So we need a special signal for this case.
|
|
74
|
+
zeroHighWaterMarkAllowEnqueue = false;
|
|
34
75
|
controller.enqueue(chunk);
|
|
76
|
+
logger?.({
|
|
77
|
+
source: "producer",
|
|
78
|
+
operation: "enqueue",
|
|
79
|
+
value: chunk,
|
|
80
|
+
phase: "complete",
|
|
81
|
+
});
|
|
35
82
|
return;
|
|
36
83
|
}
|
|
37
84
|
if (controller.desiredSize <= 0) {
|
|
85
|
+
logger?.({
|
|
86
|
+
source: "producer",
|
|
87
|
+
operation: "enqueue",
|
|
88
|
+
value: chunk,
|
|
89
|
+
phase: "waiting",
|
|
90
|
+
});
|
|
38
91
|
waterMarkLow = new PromiseResolver();
|
|
39
92
|
await waterMarkLow.promise;
|
|
93
|
+
// Recheck consumer cancellation after async operations.
|
|
94
|
+
if (abortController.signal.aborted) {
|
|
95
|
+
logger?.({
|
|
96
|
+
source: "producer",
|
|
97
|
+
operation: "enqueue",
|
|
98
|
+
value: chunk,
|
|
99
|
+
phase: "ignored",
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
40
103
|
}
|
|
41
|
-
// `controller.enqueue` will throw error for us
|
|
42
|
-
// if the stream is already errored.
|
|
43
104
|
controller.enqueue(chunk);
|
|
105
|
+
logger?.({
|
|
106
|
+
source: "producer",
|
|
107
|
+
operation: "enqueue",
|
|
108
|
+
value: chunk,
|
|
109
|
+
phase: "complete",
|
|
110
|
+
});
|
|
44
111
|
},
|
|
45
112
|
close() {
|
|
113
|
+
logger?.({
|
|
114
|
+
source: "producer",
|
|
115
|
+
operation: "close",
|
|
116
|
+
explicit: true,
|
|
117
|
+
phase: "start",
|
|
118
|
+
});
|
|
119
|
+
// Since `enqueue` on an cancelled stream won't throw an error,
|
|
120
|
+
// so does `close`.
|
|
121
|
+
if (abortController.signal.aborted) {
|
|
122
|
+
logger?.({
|
|
123
|
+
source: "producer",
|
|
124
|
+
operation: "close",
|
|
125
|
+
explicit: true,
|
|
126
|
+
phase: "ignored",
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
46
130
|
controller.close();
|
|
131
|
+
logger?.({
|
|
132
|
+
source: "producer",
|
|
133
|
+
operation: "close",
|
|
134
|
+
explicit: true,
|
|
135
|
+
phase: "complete",
|
|
136
|
+
});
|
|
47
137
|
},
|
|
48
138
|
error(e) {
|
|
139
|
+
logger?.({
|
|
140
|
+
source: "producer",
|
|
141
|
+
operation: "error",
|
|
142
|
+
explicit: true,
|
|
143
|
+
phase: "start",
|
|
144
|
+
});
|
|
145
|
+
// Calling `error` on an already closed or errored stream is a no-op.
|
|
49
146
|
controller.error(e);
|
|
147
|
+
logger?.({
|
|
148
|
+
source: "producer",
|
|
149
|
+
operation: "error",
|
|
150
|
+
explicit: true,
|
|
151
|
+
phase: "complete",
|
|
152
|
+
});
|
|
50
153
|
},
|
|
51
154
|
});
|
|
52
155
|
if (result && "then" in result) {
|
|
156
|
+
// If `source` returns a `Promise`,
|
|
157
|
+
// close the stream when the `Promise` is resolved,
|
|
158
|
+
// and error the stream when the `Promise` is rejected.
|
|
159
|
+
// The producer can return a never-settling `Promise`
|
|
160
|
+
// to disable this behavior.
|
|
53
161
|
result.then(() => {
|
|
162
|
+
logger?.({
|
|
163
|
+
source: "producer",
|
|
164
|
+
operation: "close",
|
|
165
|
+
explicit: false,
|
|
166
|
+
phase: "start",
|
|
167
|
+
});
|
|
54
168
|
try {
|
|
55
169
|
controller.close();
|
|
170
|
+
logger?.({
|
|
171
|
+
source: "producer",
|
|
172
|
+
operation: "close",
|
|
173
|
+
explicit: false,
|
|
174
|
+
phase: "complete",
|
|
175
|
+
});
|
|
56
176
|
}
|
|
57
|
-
catch
|
|
58
|
-
|
|
177
|
+
catch {
|
|
178
|
+
logger?.({
|
|
179
|
+
source: "producer",
|
|
180
|
+
operation: "close",
|
|
181
|
+
explicit: false,
|
|
182
|
+
phase: "ignored",
|
|
183
|
+
});
|
|
184
|
+
// The stream is already closed by the producer,
|
|
185
|
+
// Or cancelled by the consumer.
|
|
59
186
|
}
|
|
60
187
|
}, (e) => {
|
|
188
|
+
logger?.({
|
|
189
|
+
source: "producer",
|
|
190
|
+
operation: "error",
|
|
191
|
+
explicit: false,
|
|
192
|
+
phase: "start",
|
|
193
|
+
});
|
|
61
194
|
controller.error(e);
|
|
195
|
+
logger?.({
|
|
196
|
+
source: "producer",
|
|
197
|
+
operation: "error",
|
|
198
|
+
explicit: false,
|
|
199
|
+
phase: "complete",
|
|
200
|
+
});
|
|
62
201
|
});
|
|
63
202
|
}
|
|
64
203
|
},
|
|
65
204
|
pull: () => {
|
|
205
|
+
logger?.({
|
|
206
|
+
source: "consumer",
|
|
207
|
+
operation: "pull",
|
|
208
|
+
phase: "start",
|
|
209
|
+
});
|
|
66
210
|
if (waterMarkLow) {
|
|
67
211
|
waterMarkLow.resolve();
|
|
68
|
-
return;
|
|
69
212
|
}
|
|
70
|
-
if (strategy?.highWaterMark === 0) {
|
|
71
|
-
|
|
213
|
+
else if (strategy?.highWaterMark === 0) {
|
|
214
|
+
zeroHighWaterMarkAllowEnqueue = true;
|
|
72
215
|
}
|
|
216
|
+
logger?.({
|
|
217
|
+
source: "consumer",
|
|
218
|
+
operation: "pull",
|
|
219
|
+
phase: "complete",
|
|
220
|
+
});
|
|
73
221
|
},
|
|
74
222
|
cancel: (reason) => {
|
|
223
|
+
logger?.({
|
|
224
|
+
source: "consumer",
|
|
225
|
+
operation: "cancel",
|
|
226
|
+
phase: "start",
|
|
227
|
+
});
|
|
75
228
|
abortController.abort(reason);
|
|
76
|
-
|
|
229
|
+
// Resolve it on cancellation. `pull` will check `abortSignal.aborted` again.
|
|
230
|
+
waterMarkLow?.resolve();
|
|
231
|
+
logger?.({
|
|
232
|
+
source: "consumer",
|
|
233
|
+
operation: "cancel",
|
|
234
|
+
phase: "complete",
|
|
235
|
+
});
|
|
77
236
|
},
|
|
78
237
|
}, strategy);
|
|
79
238
|
}
|
package/esm/push-readable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-readable.js","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"push-readable.js","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqC9D,MAAM,OAAO,kBAAsB,SAAQ,cAAiB;IACxD;;;;;;OAMG;IACH,YACI,MAAmC,EACnC,QAA6B,EAC7B,MAA8B;QAE9B,IAAI,YAA+C,CAAC;QACpD,IAAI,6BAA6B,GAAG,KAAK,CAAC;QAC1C,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAE9C,KAAK,CACD;YACI,KAAK,EAAE,CAAC,UAAU,EAAE,EAAE;gBAClB,MAAM,MAAM,GAAG,MAAM,CAAC;oBAClB,WAAW,EAAE,eAAe,CAAC,MAAM;oBACnC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;wBACrB,MAAM,EAAE,CAAC;4BACL,MAAM,EAAE,U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CAAC;oBACL,MAAM,EAAE,UAAU;oBAClB,SAAS,EAAE,QAAQ;oBACnB,KAAK,EAAE,UAAU;iBACpB,CAAC,CAAC;YACP,CAAC;SACJ,EACD,QAAQ,CACX,CAAC;IACN,CAAC;CACJ"}
|
package/esm/stream.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AbortSignal, ReadableStream as ReadableStreamType, TransformStream as TransformStreamType, WritableStream as WritableStreamType } from "./types.js";
|
|
2
2
|
export * from "./types.js";
|
|
3
|
+
export { ReadableStream };
|
|
3
4
|
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
4
5
|
export interface AbortController {
|
|
5
6
|
/**
|
|
@@ -9,17 +10,16 @@ export interface AbortController {
|
|
|
9
10
|
/**
|
|
10
11
|
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
11
12
|
*/
|
|
12
|
-
abort(reason?:
|
|
13
|
+
abort(reason?: unknown): void;
|
|
13
14
|
}
|
|
14
15
|
interface AbortControllerConstructor {
|
|
15
16
|
prototype: AbortController;
|
|
16
17
|
new (): AbortController;
|
|
17
18
|
}
|
|
18
19
|
export declare const AbortController: AbortControllerConstructor;
|
|
19
|
-
export type ReadableStream<T
|
|
20
|
-
export
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
-
export declare const TransformStream: typeof TransformStreamType;
|
|
20
|
+
export type ReadableStream<T> = ReadableStreamType<T>;
|
|
21
|
+
export type WritableStream<T> = WritableStreamType<T>;
|
|
22
|
+
export type TransformStream<I, O> = TransformStreamType<I, O>;
|
|
23
|
+
declare const ReadableStream: typeof ReadableStreamType;
|
|
24
|
+
export declare const WritableStream: typeof WritableStreamType, TransformStream: typeof TransformStreamType;
|
|
25
25
|
//# sourceMappingURL=stream.d.ts.map
|
package/esm/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EAEX,cAAc,IAAI,kBAAkB,EACpC,eAAe,IAAI,mBAAmB,EACtC,cAAc,IAAI,kBAAkB,EACvC,MAAM,YAAY,CAAC;AAEpB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,iGAAiG;AACjG,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAED,UAAU,0BAA0B;IAChC,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAQ,eAAe,CAAC;CAC3B;AASD,eAAO,MAAQ,eAAe,4BAA6C,CAAC;AAE5E,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9D,QAAA,MAAM,cAAc,2BA4DhB,CAAC;AAEL,eAAO,MAAQ,cAAc,6BAAE,eAAe,4BACF,CAAC"}
|
package/esm/stream.js
CHANGED
|
@@ -1,7 +1,56 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
|
-
|
|
3
|
-
export const AbortController =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export { ReadableStream };
|
|
3
|
+
export const { AbortController } = globalThis;
|
|
4
|
+
const ReadableStream = /* #__PURE__ */ (() => {
|
|
5
|
+
const { ReadableStream } = globalThis;
|
|
6
|
+
if (!ReadableStream.from) {
|
|
7
|
+
ReadableStream.from = function (iterable) {
|
|
8
|
+
const iterator = Symbol.asyncIterator in iterable
|
|
9
|
+
? iterable[Symbol.asyncIterator]()
|
|
10
|
+
: iterable[Symbol.iterator]();
|
|
11
|
+
return new ReadableStream({
|
|
12
|
+
async pull(controller) {
|
|
13
|
+
const result = await iterator.next();
|
|
14
|
+
if (result.done) {
|
|
15
|
+
controller.close();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
controller.enqueue(result.value);
|
|
19
|
+
},
|
|
20
|
+
async cancel(reason) {
|
|
21
|
+
await iterator.return?.(reason);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (!ReadableStream.prototype[Symbol.asyncIterator] ||
|
|
27
|
+
!ReadableStream.prototype.values) {
|
|
28
|
+
ReadableStream.prototype.values = async function* (options) {
|
|
29
|
+
const reader = this.getReader();
|
|
30
|
+
try {
|
|
31
|
+
while (true) {
|
|
32
|
+
const { done, value } = await reader.read();
|
|
33
|
+
if (done) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
yield value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
// Calling `iterator.return` will enter this `finally` block.
|
|
41
|
+
// We don't need to care about the parameter to `iterator.return`,
|
|
42
|
+
// it will be returned as the final `result.value` automatically.
|
|
43
|
+
if (!options?.preventCancel) {
|
|
44
|
+
await reader.cancel();
|
|
45
|
+
}
|
|
46
|
+
reader.releaseLock();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
ReadableStream.prototype[Symbol.asyncIterator] =
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
51
|
+
ReadableStream.prototype.values;
|
|
52
|
+
}
|
|
53
|
+
return ReadableStream;
|
|
54
|
+
})();
|
|
55
|
+
export const { WritableStream, TransformStream } = globalThis;
|
|
7
56
|
//# sourceMappingURL=stream.js.map
|
package/esm/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAQA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,CAAC;AA2B1B,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,UAAwC,CAAC;AAM5E,MAAM,cAAc,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACzC,MAAM,EAAE,cAAc,EAAE,GAAG,UAAwC,CAAC;IAEpE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QACvB,cAAc,CAAC,IAAI,GAAG,UAAU,QAAQ;YACpC,MAAM,QAAQ,GACV,MAAM,CAAC,aAAa,IAAI,QAAQ;gBAC5B,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;gBAClC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAEtC,OAAO,IAAI,cAAc,CAAC;gBACtB,KAAK,CAAC,IAAI,CAAC,UAAU;oBACjB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;oBACrC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;wBACd,UAAU,CAAC,KAAK,EAAE,CAAC;wBACnB,OAAO;oBACX,CAAC;oBACD,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACD,KAAK,CAAC,MAAM,CAAC,MAAM;oBACf,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;gBACpC,CAAC;aACJ,CAAC,CAAC;QACP,CAAC,CAAC;IACN,CAAC;IAED,IACI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;QAC/C,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,EAClC,CAAC;QACC,cAAc,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,SAAS,CAAC,EAE7C,OAAuC;YAEvC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC;gBACD,OAAO,IAAI,EAAE,CAAC;oBACV,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;oBAC5C,IAAI,IAAI,EAAE,CAAC;wBACP,OAAO;oBACX,CAAC;oBACD,MAAM,KAAK,CAAC;gBAChB,CAAC;YACL,CAAC;oBAAS,CAAC;gBACP,6DAA6D;gBAC7D,kEAAkE;gBAClE,iEAAiE;gBACjE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;oBAC1B,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;gBAC1B,CAAC;gBACD,MAAM,CAAC,WAAW,EAAE,CAAC;YACzB,CAAC;QACL,CAAC,CAAC;QAEF,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;YAC1C,6DAA6D;YAC7D,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC;IACxC,CAAC;IAED,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAC5C,UAAwC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { StructValueType } from "@yume-chan/struct";
|
|
1
|
+
import type { StructLike } from "@yume-chan/struct";
|
|
3
2
|
import { BufferedTransformStream } from "./buffered-transform.js";
|
|
4
|
-
export declare class StructDeserializeStream<T extends
|
|
5
|
-
constructor(struct: T);
|
|
3
|
+
export declare class StructDeserializeStream<T> extends BufferedTransformStream<T> {
|
|
4
|
+
constructor(struct: StructLike<T>);
|
|
6
5
|
}
|
|
7
6
|
//# sourceMappingURL=struct-deserialize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct-deserialize.d.ts","sourceRoot":"","sources":["../src/struct-deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"struct-deserialize.d.ts","sourceRoot":"","sources":["../src/struct-deserialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,qBAAa,uBAAuB,CAAC,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;gBAC1D,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAKpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct-deserialize.js","sourceRoot":"","sources":["../src/struct-deserialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"struct-deserialize.js","sourceRoot":"","sources":["../src/struct-deserialize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,OAAO,uBAA2B,SAAQ,uBAA0B;IACtE,YAAY,MAAqB;QAC7B,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;YACb,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAU,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { StructInit, StructLike } from "@yume-chan/struct";
|
|
2
2
|
import { TransformStream } from "./stream.js";
|
|
3
|
-
export declare class StructSerializeStream<T extends
|
|
3
|
+
export declare class StructSerializeStream<T extends StructLike<unknown>> extends TransformStream<StructInit<T>, Uint8Array> {
|
|
4
4
|
constructor(struct: T);
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=struct-serialize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct-serialize.d.ts","sourceRoot":"","sources":["../src/struct-serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"struct-serialize.d.ts","sourceRoot":"","sources":["../src/struct-serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,qBAAqB,CAC9B,CAAC,SAAS,UAAU,CAAC,OAAO,CAAC,CAC/B,SAAQ,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;gBACpC,MAAM,EAAE,CAAC;CAOxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"struct-serialize.js","sourceRoot":"","sources":["../src/struct-serialize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,OAAO,qBAEX,SAAQ,
|
|
1
|
+
{"version":3,"file":"struct-serialize.js","sourceRoot":"","sources":["../src/struct-serialize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,OAAO,qBAEX,SAAQ,eAA0C;IAChD,YAAY,MAAS;QACjB,KAAK,CAAC;YACF,SAAS,CAAC,KAAK,EAAE,UAAU;gBACvB,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YAChD,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/esm/task.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACjB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;CAChC;AAYD,eAAO,MAAM,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAMjC,CAAC"}
|
package/esm/task.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// `createTask` allows browser DevTools to track the call stack across async boundaries.
|
|
2
|
+
const { console } = globalThis;
|
|
3
|
+
export const createTask = /* #__PURE__ */ (() => console?.createTask?.bind(console) ??
|
|
4
|
+
(() => ({
|
|
5
|
+
run(callback) {
|
|
6
|
+
return callback();
|
|
7
|
+
},
|
|
8
|
+
})))();
|
|
9
|
+
//# sourceMappingURL=task.js.map
|
package/esm/task.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAYA,wFAAwF;AACxF,MAAM,EAAE,OAAO,EAAE,GAAG,UAAwC,CAAC;AAC7D,MAAM,CAAC,MAAM,UAAU,GAA2B,eAAe,CAAC,CAAC,GAAG,EAAE,CACpE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC;IAClC,CAAC,GAAG,EAAE,CAAC,CAAC;QACJ,GAAG,CAAC,QAAQ;YACR,OAAO,QAAQ,EAAE,CAAC;QACtB,CAAC;KACJ,CAAC,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BufferedReadableStream } from "./buffered.js";
|
|
2
|
+
import type { PushReadableStreamController } from "./push-readable.js";
|
|
3
|
+
import type { ReadableStream, ReadableStreamDefaultController, ReadableStreamDefaultReader, WritableStreamDefaultWriter } from "./stream.js";
|
|
4
|
+
export declare function tryClose(controller: PushReadableStreamController<unknown>): boolean;
|
|
5
|
+
export declare function tryClose(controller: ReadableStreamDefaultController<unknown>): boolean;
|
|
6
|
+
export declare function tryClose(writer: WritableStreamDefaultWriter<never>): boolean;
|
|
7
|
+
export declare function tryCancel(stream: ReadableStream<unknown>): Promise<boolean>;
|
|
8
|
+
export declare function tryCancel(stream: BufferedReadableStream): Promise<boolean>;
|
|
9
|
+
export declare function tryCancel(reader: ReadableStreamDefaultReader<unknown>): Promise<boolean>;
|
|
10
|
+
//# sourceMappingURL=try-close.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"try-close.d.ts","sourceRoot":"","sources":["../src/try-close.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EACR,cAAc,EACd,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC9B,MAAM,aAAa,CAAC;AAErB,wBAAgB,QAAQ,CACpB,UAAU,EAAE,4BAA4B,CAAC,OAAO,CAAC,GAClD,OAAO,CAAC;AACX,wBAAgB,QAAQ,CACpB,UAAU,EAAE,+BAA+B,CAAC,OAAO,CAAC,GACrD,OAAO,CAAC;AACX,wBAAgB,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;AAU9E,wBAAsB,SAAS,CAC3B,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,GAChC,OAAO,CAAC,OAAO,CAAC,CAAC;AACpB,wBAAsB,SAAS,CAC3B,MAAM,EAAE,sBAAsB,GAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;AACpB,wBAAsB,SAAS,CAC3B,MAAM,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAC7C,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
package/esm/try-close.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function tryClose(controller) {
|
|
2
|
+
try {
|
|
3
|
+
controller.close();
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export async function tryCancel(stream) {
|
|
11
|
+
try {
|
|
12
|
+
await stream.cancel();
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=try-close.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"try-close.js","sourceRoot":"","sources":["../src/try-close.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,QAAQ,CAAC,UAA6B;IAClD,IAAI,CAAC;QACD,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAWD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAE/B;IACG,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
|