@yume-chan/stream-extra 2.6.1 → 3.0.0-beta.1
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/LICENSE +1 -1
- package/esm/buffered-transform.d.ts +2 -2
- package/esm/buffered-transform.d.ts.map +1 -1
- package/esm/buffered-transform.js +16 -16
- package/esm/buffered-transform.js.map +1 -1
- package/esm/buffered.d.ts +1 -1
- package/esm/buffered.d.ts.map +1 -1
- package/esm/buffered.js.map +1 -1
- package/esm/concat.d.ts +25 -16
- package/esm/concat.d.ts.map +1 -1
- package/esm/concat.js +124 -93
- package/esm/concat.js.map +1 -1
- package/esm/consumable/readable.d.ts +2 -2
- package/esm/consumable/readable.d.ts.map +1 -1
- package/esm/consumable/readable.js +1 -1
- package/esm/consumable/readable.js.map +1 -1
- package/esm/consumable/wrap-byte-readable.d.ts +5 -2
- package/esm/consumable/wrap-byte-readable.d.ts.map +1 -1
- package/esm/consumable/wrap-byte-readable.js +12 -6
- package/esm/consumable/wrap-byte-readable.js.map +1 -1
- package/esm/consumable/wrap-writable.d.ts +1 -1
- package/esm/consumable/wrap-writable.d.ts.map +1 -1
- package/esm/consumable/wrap-writable.js +1 -1
- package/esm/consumable/wrap-writable.js.map +1 -1
- package/esm/consumable/writable.d.ts +2 -2
- package/esm/consumable/writable.d.ts.map +1 -1
- package/esm/consumable/writable.js +1 -1
- package/esm/consumable/writable.js.map +1 -1
- package/esm/consumable.d.ts +4 -0
- package/esm/consumable.d.ts.map +1 -1
- package/esm/consumable.js +5 -0
- package/esm/consumable.js.map +1 -1
- package/esm/distribution.d.ts +1 -1
- package/esm/distribution.d.ts.map +1 -1
- package/esm/distribution.js +1 -1
- 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 +1 -1
- package/esm/duplex.js.map +1 -1
- package/esm/global/abort-signal.d.ts +87 -0
- package/esm/global/abort-signal.d.ts.map +1 -0
- package/esm/global/abort-signal.js +4 -0
- package/esm/global/abort-signal.js.map +1 -0
- package/esm/global/compression.d.ts +15 -0
- package/esm/global/compression.d.ts.map +1 -0
- package/esm/global/compression.js +4 -0
- package/esm/global/compression.js.map +1 -0
- package/esm/global/encoding.d.ts +25 -0
- package/esm/global/encoding.d.ts.map +1 -0
- package/esm/global/encoding.js +4 -0
- package/esm/global/encoding.js.map +1 -0
- package/esm/global/event.d.ts +191 -0
- package/esm/global/event.d.ts.map +1 -0
- package/esm/global/event.js +4 -0
- package/esm/global/event.js.map +1 -0
- package/esm/global/index.d.ts +7 -0
- package/esm/global/index.d.ts.map +1 -0
- package/esm/global/index.js +7 -0
- package/esm/global/index.js.map +1 -0
- package/esm/{types.d.ts → global/streams.d.ts} +136 -222
- package/esm/global/streams.d.ts.map +1 -0
- package/esm/{stream.js → global/streams.js} +16 -8
- package/esm/global/streams.js.map +1 -0
- package/esm/global/timer.d.ts +13 -0
- package/esm/global/timer.d.ts.map +1 -0
- package/esm/global/timer.js +4 -0
- package/esm/global/timer.js.map +1 -0
- package/esm/global/utils.d.ts +9 -0
- package/esm/global/utils.d.ts.map +1 -0
- package/esm/global/utils.js +5 -0
- package/esm/global/utils.js.map +1 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/inspect.d.ts +6 -2
- package/esm/inspect.d.ts.map +1 -1
- package/esm/inspect.js +10 -4
- package/esm/inspect.js.map +1 -1
- package/esm/maybe-consumable/wrap-writable.d.ts +1 -1
- package/esm/maybe-consumable/wrap-writable.d.ts.map +1 -1
- package/esm/maybe-consumable/wrap-writable.js +1 -1
- package/esm/maybe-consumable/wrap-writable.js.map +1 -1
- package/esm/maybe-consumable/writable.d.ts +2 -2
- package/esm/maybe-consumable/writable.d.ts.map +1 -1
- package/esm/maybe-consumable/writable.js +1 -1
- package/esm/maybe-consumable/writable.js.map +1 -1
- package/esm/pipe-from.d.ts +3 -3
- package/esm/pipe-from.d.ts.map +1 -1
- package/esm/pipe-from.js +1 -1
- package/esm/pipe-from.js.map +1 -1
- package/esm/push-readable.d.ts +2 -2
- package/esm/push-readable.d.ts.map +1 -1
- package/esm/push-readable.js +1 -1
- package/esm/push-readable.js.map +1 -1
- package/esm/split-string.d.ts +6 -2
- package/esm/split-string.d.ts.map +1 -1
- package/esm/split-string.js +28 -7
- package/esm/split-string.js.map +1 -1
- package/esm/struct-deserialize.js.map +1 -1
- package/esm/struct-serialize.d.ts +1 -1
- package/esm/struct-serialize.d.ts.map +1 -1
- package/esm/struct-serialize.js +1 -1
- package/esm/struct-serialize.js.map +1 -1
- package/esm/try-close.d.ts +3 -5
- package/esm/try-close.d.ts.map +1 -1
- package/esm/try-close.js.map +1 -1
- package/esm/wrap-readable.d.ts +2 -2
- package/esm/wrap-readable.d.ts.map +1 -1
- package/esm/wrap-readable.js +1 -1
- 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 +1 -1
- package/esm/wrap-writable.js.map +1 -1
- package/package.json +10 -10
- package/src/buffered-transform.ts +24 -25
- package/src/buffered.ts +4 -1
- package/src/concat.ts +161 -118
- package/src/consumable/readable.ts +2 -2
- package/src/consumable/wrap-byte-readable.ts +20 -7
- package/src/consumable/wrap-writable.ts +1 -1
- package/src/consumable/writable.ts +2 -2
- package/src/consumable.ts +8 -0
- package/src/distribution.ts +1 -1
- package/src/duplex.ts +2 -2
- package/src/global/abort-signal.ts +129 -0
- package/src/global/compression.ts +28 -0
- package/src/global/encoding.ts +36 -0
- package/src/global/event.ts +220 -0
- package/src/global/index.ts +6 -0
- package/src/{types.ts → global/streams.ts} +266 -244
- package/src/global/timer.ts +18 -0
- package/src/global/utils.ts +14 -0
- package/src/index.ts +2 -2
- package/src/inspect.ts +18 -4
- package/src/maybe-consumable/wrap-writable.ts +1 -1
- package/src/maybe-consumable/writable.ts +3 -3
- package/src/pipe-from.ts +2 -2
- package/src/push-readable.ts +2 -2
- package/src/split-string.ts +41 -7
- package/src/struct-deserialize.ts +1 -1
- package/src/struct-serialize.ts +1 -1
- package/src/try-close.ts +0 -12
- package/src/wrap-readable.ts +2 -2
- package/src/wrap-writable.ts +5 -2
- package/tsconfig.build.json +1 -6
- package/CHANGELOG.md +0 -102
- package/esm/encoding.d.ts +0 -21
- package/esm/encoding.d.ts.map +0 -1
- package/esm/encoding.js +0 -4
- package/esm/encoding.js.map +0 -1
- package/esm/stream.d.ts +0 -25
- package/esm/stream.d.ts.map +0 -1
- package/esm/stream.js.map +0 -1
- package/esm/types.d.ts.map +0 -1
- package/esm/types.js +0 -3
- package/esm/types.js.map +0 -1
- package/src/encoding.ts +0 -39
- package/src/stream.ts +0 -106
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getGlobalValue } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
interface TimerHandler {
|
|
4
|
+
(...args: unknown[]): void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface SetTimeoutFunction {
|
|
8
|
+
(handler: TimerHandler, timeout?: number, ...args: unknown[]): number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ClearTimeoutFunction {
|
|
12
|
+
(timeoutId: number): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const setTimeout =
|
|
16
|
+
getGlobalValue<SetTimeoutFunction>("setTimeout") ?? (() => {});
|
|
17
|
+
export const clearTimeout =
|
|
18
|
+
getGlobalValue<ClearTimeoutFunction>("clearTimeout") ?? (() => {});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type GlobalPrototypeOr<K extends string, Or> =
|
|
2
|
+
typeof globalThis extends Record<K, { prototype: infer T }> ? T : Or;
|
|
3
|
+
|
|
4
|
+
export type GlobalValueOr<
|
|
5
|
+
K extends string,
|
|
6
|
+
Or,
|
|
7
|
+
> = (typeof globalThis extends Record<K, infer T> ? T : Or) & {
|
|
8
|
+
__keepAlias?: never;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** #__NO_SIDE_EFFECTS__ */
|
|
12
|
+
export function getGlobalValue<T>(key: string) {
|
|
13
|
+
return (globalThis as unknown as Record<string, T>)[key]!;
|
|
14
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,15 +4,15 @@ export * from "./concat.js";
|
|
|
4
4
|
export * from "./consumable.js";
|
|
5
5
|
export * from "./distribution.js";
|
|
6
6
|
export * from "./duplex.js";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./global/index.js";
|
|
8
8
|
export * from "./inspect.js";
|
|
9
9
|
export * from "./maybe-consumable.js";
|
|
10
10
|
export * from "./pipe-from.js";
|
|
11
11
|
export * from "./push-readable.js";
|
|
12
12
|
export * from "./split-string.js";
|
|
13
|
-
export * from "./stream.js";
|
|
14
13
|
export * from "./struct-deserialize.js";
|
|
15
14
|
export * from "./struct-serialize.js";
|
|
15
|
+
export * from "./task-queue.js";
|
|
16
16
|
export * from "./task.js";
|
|
17
17
|
export * from "./try-close.js";
|
|
18
18
|
export * from "./wrap-readable.js";
|
package/src/inspect.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
|
+
|
|
3
|
+
import { TransformStream } from "./global/index.js";
|
|
2
4
|
|
|
3
5
|
export class InspectStream<T> extends TransformStream<T, T> {
|
|
4
|
-
constructor(
|
|
6
|
+
constructor(
|
|
7
|
+
write: (value: T) => MaybePromiseLike<undefined>,
|
|
8
|
+
extras?: {
|
|
9
|
+
close?: (() => void) | undefined;
|
|
10
|
+
cancel?: (() => void) | undefined;
|
|
11
|
+
},
|
|
12
|
+
) {
|
|
5
13
|
super({
|
|
6
|
-
transform(chunk, controller) {
|
|
7
|
-
|
|
14
|
+
async transform(chunk, controller) {
|
|
15
|
+
await write(chunk);
|
|
8
16
|
controller.enqueue(chunk);
|
|
9
17
|
},
|
|
18
|
+
flush() {
|
|
19
|
+
extras?.close?.();
|
|
20
|
+
},
|
|
21
|
+
cancel() {
|
|
22
|
+
extras?.cancel?.();
|
|
23
|
+
},
|
|
10
24
|
});
|
|
11
25
|
}
|
|
12
26
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Consumable } from "../consumable.js";
|
|
2
|
-
import type { MaybeConsumable } from "../maybe-consumable.js";
|
|
3
2
|
import type {
|
|
4
3
|
QueuingStrategy,
|
|
5
4
|
WritableStreamDefaultController,
|
|
6
|
-
} from "../
|
|
7
|
-
import { WritableStream } from "../
|
|
5
|
+
} from "../global/index.js";
|
|
6
|
+
import { WritableStream } from "../global/index.js";
|
|
7
|
+
import type { MaybeConsumable } from "../maybe-consumable.js";
|
|
8
8
|
|
|
9
9
|
import { tryConsume } from "./utils.js";
|
|
10
10
|
|
package/src/pipe-from.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReadableWritablePair } from "./
|
|
2
|
-
import { WritableStream } from "./
|
|
1
|
+
import type { ReadableWritablePair } from "./global/index.js";
|
|
2
|
+
import { WritableStream } from "./global/index.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Pipe `pair.readable` to `writable`, then returns `pair.writable`.
|
package/src/push-readable.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type {
|
|
|
5
5
|
AbortSignal,
|
|
6
6
|
QueuingStrategy,
|
|
7
7
|
ReadableStreamDefaultController,
|
|
8
|
-
} from "./
|
|
9
|
-
import { AbortController, ReadableStream } from "./
|
|
8
|
+
} from "./global/index.js";
|
|
9
|
+
import { AbortController, ReadableStream } from "./global/index.js";
|
|
10
10
|
import { TaskQueue } from "./task-queue.js";
|
|
11
11
|
|
|
12
12
|
export interface PushReadableStreamController<T> {
|
package/src/split-string.ts
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TransformStreamDefaultController } from "./global/index.js";
|
|
2
|
+
import { TransformStream } from "./global/index.js";
|
|
2
3
|
|
|
3
4
|
export class SplitStringStream extends TransformStream<string, string> {
|
|
4
|
-
constructor(
|
|
5
|
+
constructor(
|
|
6
|
+
separator: string,
|
|
7
|
+
options?: {
|
|
8
|
+
trim?: boolean | undefined;
|
|
9
|
+
trimEnd?: boolean | undefined;
|
|
10
|
+
skipEmpty?: boolean | undefined;
|
|
11
|
+
},
|
|
12
|
+
) {
|
|
5
13
|
let remaining: string | undefined = undefined;
|
|
14
|
+
const separatorLength = separator.length;
|
|
15
|
+
if (separatorLength === 0) {
|
|
16
|
+
throw new Error("separator must not be empty");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const trim = !!options?.trim;
|
|
20
|
+
const trimEnd = !!options?.trimEnd;
|
|
21
|
+
const skipEmpty = !!options?.skipEmpty;
|
|
22
|
+
const enqueue = (
|
|
23
|
+
controller: TransformStreamDefaultController<string>,
|
|
24
|
+
value: string,
|
|
25
|
+
) => {
|
|
26
|
+
if (trim) {
|
|
27
|
+
value = value.trim();
|
|
28
|
+
} else if (trimEnd) {
|
|
29
|
+
value = value.trimEnd();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (value || !skipEmpty) {
|
|
33
|
+
controller.enqueue(value);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
6
36
|
|
|
7
37
|
super({
|
|
8
38
|
transform(chunk, controller) {
|
|
9
|
-
if (remaining) {
|
|
39
|
+
if (remaining !== undefined) {
|
|
10
40
|
chunk = remaining + chunk;
|
|
11
41
|
remaining = undefined;
|
|
12
42
|
}
|
|
@@ -15,17 +45,21 @@ export class SplitStringStream extends TransformStream<string, string> {
|
|
|
15
45
|
while (start < chunk.length) {
|
|
16
46
|
const index = chunk.indexOf(separator, start);
|
|
17
47
|
if (index === -1) {
|
|
48
|
+
// `remaining` can't be an empty string
|
|
49
|
+
// because `start` is less than `chunk.length`
|
|
18
50
|
remaining = chunk.substring(start);
|
|
19
51
|
break;
|
|
20
52
|
}
|
|
21
53
|
|
|
22
|
-
|
|
23
|
-
|
|
54
|
+
const value = chunk.substring(start, index);
|
|
55
|
+
enqueue(controller, value);
|
|
56
|
+
|
|
57
|
+
start = index + separatorLength;
|
|
24
58
|
}
|
|
25
59
|
},
|
|
26
60
|
flush(controller) {
|
|
27
|
-
if (remaining) {
|
|
28
|
-
|
|
61
|
+
if (remaining !== undefined) {
|
|
62
|
+
enqueue(controller, remaining);
|
|
29
63
|
}
|
|
30
64
|
},
|
|
31
65
|
});
|
|
@@ -5,7 +5,7 @@ import { BufferedTransformStream } from "./buffered-transform.js";
|
|
|
5
5
|
export class StructDeserializeStream<T> extends BufferedTransformStream<T> {
|
|
6
6
|
constructor(struct: StructDeserializer<T>) {
|
|
7
7
|
super((stream) => {
|
|
8
|
-
return struct.deserialize(stream)
|
|
8
|
+
return struct.deserialize(stream);
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
}
|
package/src/struct-serialize.ts
CHANGED
package/src/try-close.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
import { isPromiseLike } from "@yume-chan/async";
|
|
3
3
|
|
|
4
|
-
import type { BufferedReadableStream } from "./buffered.js";
|
|
5
|
-
import type { ReadableStream, ReadableStreamDefaultReader } from "./stream.js";
|
|
6
|
-
|
|
7
4
|
export function tryClose(value: {
|
|
8
5
|
close(): PromiseLike<void>;
|
|
9
6
|
}): Promise<boolean>;
|
|
@@ -23,15 +20,6 @@ export function tryClose(value: { close(): MaybePromiseLike<void> }) {
|
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
export async function tryCancel(
|
|
27
|
-
stream: ReadableStream<unknown>,
|
|
28
|
-
): Promise<boolean>;
|
|
29
|
-
export async function tryCancel(
|
|
30
|
-
stream: BufferedReadableStream,
|
|
31
|
-
): Promise<boolean>;
|
|
32
|
-
export async function tryCancel(
|
|
33
|
-
reader: ReadableStreamDefaultReader<unknown>,
|
|
34
|
-
): Promise<boolean>;
|
|
35
23
|
export async function tryCancel(stream: {
|
|
36
24
|
cancel(): Promise<void>;
|
|
37
25
|
}): Promise<boolean> {
|
package/src/wrap-readable.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type {
|
|
|
4
4
|
QueuingStrategy,
|
|
5
5
|
ReadableStreamDefaultController,
|
|
6
6
|
ReadableStreamDefaultReader,
|
|
7
|
-
} from "./
|
|
8
|
-
import { ReadableStream } from "./
|
|
7
|
+
} from "./global/index.js";
|
|
8
|
+
import { ReadableStream } from "./global/index.js";
|
|
9
9
|
|
|
10
10
|
export type WrapReadableStreamStart<T> = (
|
|
11
11
|
controller: ReadableStreamDefaultController<T>,
|
package/src/wrap-writable.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type {
|
|
4
|
+
TransformStream,
|
|
5
|
+
WritableStreamDefaultWriter,
|
|
6
|
+
} from "./global/index.js";
|
|
7
|
+
import { WritableStream } from "./global/index.js";
|
|
5
8
|
|
|
6
9
|
export type WrapWritableStreamStart<T> = () => MaybePromiseLike<
|
|
7
10
|
WritableStream<T>
|
package/tsconfig.build.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Change Log - @yume-chan/stream-extra
|
|
2
|
-
|
|
3
|
-
## 2.1.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 40a60ca: Add `Consumable.WrapByteReadableStream` and `MaybeConsumable.WrapWritableStream`
|
|
8
|
-
|
|
9
|
-
## 2.0.1
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- Updated dependencies [0bcb9b8]
|
|
14
|
-
- @yume-chan/struct@2.0.1
|
|
15
|
-
|
|
16
|
-
## 2.0.0
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- Updated dependencies [b79df96]
|
|
21
|
-
- @yume-chan/struct@2.0.0
|
|
22
|
-
|
|
23
|
-
## 1.0.1
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- 53688d3: Use PNPM workspace and Changesets to manage the monorepo.
|
|
28
|
-
|
|
29
|
-
Because Changesets doesn't support alpha versions (`0.x.x`), this version is `1.0.0`. Future versions will follow SemVer rules, for example, breaking API changes will introduce a new major version.
|
|
30
|
-
|
|
31
|
-
- ea5002b: Polyfill `ReadableStream.from` and `ReadableStream.prototype.values`
|
|
32
|
-
- Updated dependencies [53688d3]
|
|
33
|
-
- Updated dependencies [db8466f]
|
|
34
|
-
- Updated dependencies [db8466f]
|
|
35
|
-
- @yume-chan/struct@1.0.1
|
|
36
|
-
|
|
37
|
-
This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
|
|
38
|
-
|
|
39
|
-
## 0.0.24
|
|
40
|
-
|
|
41
|
-
Tue, 18 Jun 2024 02:49:43 GMT
|
|
42
|
-
|
|
43
|
-
### Updates
|
|
44
|
-
|
|
45
|
-
- Add `MaybeConsumable` type. It's also a namespace containing related types.
|
|
46
|
-
- Re-export global `TextDecoderStream` to replace `DecodeUtf8Stream` which doesn't work correctly in stream mode
|
|
47
|
-
- Move `Consumable` related types to the `Consumable` namespace. In future, more types will be moved to namespaces.
|
|
48
|
-
|
|
49
|
-
## 0.0.23
|
|
50
|
-
|
|
51
|
-
Thu, 21 Mar 2024 03:15:10 GMT
|
|
52
|
-
|
|
53
|
-
### Updates
|
|
54
|
-
|
|
55
|
-
- Fix `ConsumableWritableStream.write` calls `chunk.consume` twice. (doesn't cause any issue)
|
|
56
|
-
- Fix `WrapWritableStream` might close the inner stream twice. (and throw an error)
|
|
57
|
-
- Remove web-streams-polyfill dependency. The runtime must have global stream implementations (or you can add a polyfill yourself).
|
|
58
|
-
|
|
59
|
-
## 0.0.22
|
|
60
|
-
|
|
61
|
-
Wed, 13 Dec 2023 05:57:27 GMT
|
|
62
|
-
|
|
63
|
-
_Version update only_
|
|
64
|
-
|
|
65
|
-
## 0.0.21
|
|
66
|
-
|
|
67
|
-
Fri, 25 Aug 2023 14:05:18 GMT
|
|
68
|
-
|
|
69
|
-
### Updates
|
|
70
|
-
|
|
71
|
-
- Replace `GatherStringStream` with `ConcatStringStream` which can be treated as a Promise
|
|
72
|
-
|
|
73
|
-
## 0.0.20
|
|
74
|
-
|
|
75
|
-
Mon, 05 Jun 2023 02:51:41 GMT
|
|
76
|
-
|
|
77
|
-
### Updates
|
|
78
|
-
|
|
79
|
-
- Fix a bug where `BufferedReadableStream#release` might output duplicate data.
|
|
80
|
-
- Use ECMAScript private class fields syntax (supported by Chrome 74, Firefox 90, Safari 14.1 and Node.js 12.0.0).
|
|
81
|
-
|
|
82
|
-
## 0.0.19
|
|
83
|
-
|
|
84
|
-
Sun, 09 Apr 2023 05:55:33 GMT
|
|
85
|
-
|
|
86
|
-
### Updates
|
|
87
|
-
|
|
88
|
-
- Add an option to combine small chunks into target size in `ChunkStream`, and rename it to `DistributionStream`
|
|
89
|
-
|
|
90
|
-
## 0.0.18
|
|
91
|
-
|
|
92
|
-
Wed, 25 Jan 2023 21:33:49 GMT
|
|
93
|
-
|
|
94
|
-
### Updates
|
|
95
|
-
|
|
96
|
-
- Change to load native Web Streams API implementation from `globalThis` if available
|
|
97
|
-
|
|
98
|
-
## 0.0.17
|
|
99
|
-
|
|
100
|
-
Tue, 18 Oct 2022 09:32:30 GMT
|
|
101
|
-
|
|
102
|
-
_Initial release_
|
package/esm/encoding.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TransformStream } from "./stream.js";
|
|
2
|
-
export interface TextDecoderOptions {
|
|
3
|
-
fatal?: boolean;
|
|
4
|
-
ignoreBOM?: boolean;
|
|
5
|
-
}
|
|
6
|
-
declare class TextDecoderStreamType extends TransformStream<ArrayBufferView | ArrayBuffer, string> {
|
|
7
|
-
constructor(label?: string, options?: TextDecoderOptions);
|
|
8
|
-
readonly encoding: string;
|
|
9
|
-
readonly fatal: boolean;
|
|
10
|
-
readonly ignoreBOM: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare class TextEncoderStreamType extends TransformStream<string, Uint8Array> {
|
|
13
|
-
constructor();
|
|
14
|
-
readonly encoding: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const TextDecoderStream: typeof TextDecoderStreamType;
|
|
17
|
-
export type TextDecoderStream = TextDecoderStreamType;
|
|
18
|
-
export declare const TextEncoderStream: typeof TextEncoderStreamType;
|
|
19
|
-
export type TextEncoderStream = TextEncoderStreamType;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=encoding.d.ts.map
|
package/esm/encoding.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,OAAO,OAAO,qBAAsB,SAAQ,eAAe,CACvD,eAAe,GAAG,WAAW,EAC7B,MAAM,CACT;gBACe,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB;IAExD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC/B;AAED,OAAO,OAAO,qBAAsB,SAAQ,eAAe,CACvD,MAAM,EACN,UAAU,CACb;;IAGG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B;AASD,eAAO,MAAM,iBAAiB,8BAA2B,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEtD,eAAO,MAAM,iBAAiB,8BAA2B,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
|
package/esm/encoding.js
DELETED
package/esm/encoding.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAgCA,MAAM,MAAM,GAAG,UAAwC,CAAC;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAG1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC"}
|
package/esm/stream.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { AbortSignal, ReadableStream as ReadableStreamType, TransformStream as TransformStreamType, WritableStream as WritableStreamType } from "./types.js";
|
|
2
|
-
export * from "./types.js";
|
|
3
|
-
export { ReadableStream };
|
|
4
|
-
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
5
|
-
export interface AbortController {
|
|
6
|
-
/**
|
|
7
|
-
* Returns the AbortSignal object associated with this object.
|
|
8
|
-
*/
|
|
9
|
-
readonly signal: AbortSignal;
|
|
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.
|
|
12
|
-
*/
|
|
13
|
-
abort(reason?: unknown): void;
|
|
14
|
-
}
|
|
15
|
-
interface AbortControllerConstructor {
|
|
16
|
-
prototype: AbortController;
|
|
17
|
-
new (): AbortController;
|
|
18
|
-
}
|
|
19
|
-
export declare const AbortController: AbortControllerConstructor;
|
|
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
|
-
//# sourceMappingURL=stream.d.ts.map
|
package/esm/stream.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAQA,cAAc,YAAY,CAAC;AAC3B,OAA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OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IACtB;;;;;;;;;OASG;IACH,WAAW,IAAI,IAAI;IACnB;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CACjC;AAED,OAAO,EAAE,CAAC"}
|
package/esm/types.js
DELETED
package/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAi3B5C,OAAO,EAAE,CAAC"}
|
package/src/encoding.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { TransformStream } from "./stream.js";
|
|
2
|
-
|
|
3
|
-
export interface TextDecoderOptions {
|
|
4
|
-
fatal?: boolean;
|
|
5
|
-
ignoreBOM?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare class TextDecoderStreamType extends TransformStream<
|
|
9
|
-
ArrayBufferView | ArrayBuffer,
|
|
10
|
-
string
|
|
11
|
-
> {
|
|
12
|
-
constructor(label?: string, options?: TextDecoderOptions);
|
|
13
|
-
|
|
14
|
-
readonly encoding: string;
|
|
15
|
-
readonly fatal: boolean;
|
|
16
|
-
readonly ignoreBOM: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare class TextEncoderStreamType extends TransformStream<
|
|
20
|
-
string,
|
|
21
|
-
Uint8Array
|
|
22
|
-
> {
|
|
23
|
-
constructor();
|
|
24
|
-
|
|
25
|
-
readonly encoding: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface GlobalExtension {
|
|
29
|
-
TextDecoderStream: typeof TextDecoderStreamType;
|
|
30
|
-
TextEncoderStream: typeof TextEncoderStreamType;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const Global = globalThis as unknown as GlobalExtension;
|
|
34
|
-
|
|
35
|
-
export const TextDecoderStream = Global.TextDecoderStream;
|
|
36
|
-
export type TextDecoderStream = TextDecoderStreamType;
|
|
37
|
-
|
|
38
|
-
export const TextEncoderStream = Global.TextEncoderStream;
|
|
39
|
-
export type TextEncoderStream = TextEncoderStreamType;
|
package/src/stream.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AbortSignal,
|
|
3
|
-
ReadableStreamIteratorOptions,
|
|
4
|
-
ReadableStream as ReadableStreamType,
|
|
5
|
-
TransformStream as TransformStreamType,
|
|
6
|
-
WritableStream as WritableStreamType,
|
|
7
|
-
} from "./types.js";
|
|
8
|
-
|
|
9
|
-
export * from "./types.js";
|
|
10
|
-
export { ReadableStream };
|
|
11
|
-
|
|
12
|
-
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
13
|
-
export interface AbortController {
|
|
14
|
-
/**
|
|
15
|
-
* Returns the AbortSignal object associated with this object.
|
|
16
|
-
*/
|
|
17
|
-
readonly signal: AbortSignal;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 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.
|
|
21
|
-
*/
|
|
22
|
-
abort(reason?: unknown): void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface AbortControllerConstructor {
|
|
26
|
-
prototype: AbortController;
|
|
27
|
-
new (): AbortController;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface GlobalExtension {
|
|
31
|
-
AbortController: AbortControllerConstructor;
|
|
32
|
-
ReadableStream: typeof ReadableStreamType;
|
|
33
|
-
WritableStream: typeof WritableStreamType;
|
|
34
|
-
TransformStream: typeof TransformStreamType;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const { AbortController } = globalThis as unknown as GlobalExtension;
|
|
38
|
-
|
|
39
|
-
export type ReadableStream<T> = ReadableStreamType<T>;
|
|
40
|
-
export type WritableStream<T> = WritableStreamType<T>;
|
|
41
|
-
export type TransformStream<I, O> = TransformStreamType<I, O>;
|
|
42
|
-
|
|
43
|
-
const ReadableStream = /* #__PURE__ */ (() => {
|
|
44
|
-
const { ReadableStream } = globalThis as unknown as GlobalExtension;
|
|
45
|
-
|
|
46
|
-
if (!ReadableStream.from) {
|
|
47
|
-
ReadableStream.from = function (iterable) {
|
|
48
|
-
const iterator =
|
|
49
|
-
Symbol.asyncIterator in iterable
|
|
50
|
-
? iterable[Symbol.asyncIterator]()
|
|
51
|
-
: iterable[Symbol.iterator]();
|
|
52
|
-
|
|
53
|
-
return new ReadableStream({
|
|
54
|
-
async pull(controller) {
|
|
55
|
-
const result = await iterator.next();
|
|
56
|
-
if (result.done) {
|
|
57
|
-
controller.close();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
controller.enqueue(result.value);
|
|
61
|
-
},
|
|
62
|
-
async cancel(reason) {
|
|
63
|
-
await iterator.return?.(reason);
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
!ReadableStream.prototype[Symbol.asyncIterator] ||
|
|
71
|
-
!ReadableStream.prototype.values
|
|
72
|
-
) {
|
|
73
|
-
ReadableStream.prototype.values = async function* <R>(
|
|
74
|
-
this: ReadableStream<R>,
|
|
75
|
-
options?: ReadableStreamIteratorOptions,
|
|
76
|
-
) {
|
|
77
|
-
const reader = this.getReader();
|
|
78
|
-
try {
|
|
79
|
-
while (true) {
|
|
80
|
-
const { done, value } = await reader.read();
|
|
81
|
-
if (done) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
yield value;
|
|
85
|
-
}
|
|
86
|
-
} finally {
|
|
87
|
-
// Calling `iterator.return` will enter this `finally` block.
|
|
88
|
-
// We don't need to care about the parameter to `iterator.return`,
|
|
89
|
-
// it will be returned as the final `result.value` automatically.
|
|
90
|
-
if (!options?.preventCancel) {
|
|
91
|
-
await reader.cancel();
|
|
92
|
-
}
|
|
93
|
-
reader.releaseLock();
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
ReadableStream.prototype[Symbol.asyncIterator] =
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
99
|
-
ReadableStream.prototype.values;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return ReadableStream;
|
|
103
|
-
})();
|
|
104
|
-
|
|
105
|
-
export const { WritableStream, TransformStream } =
|
|
106
|
-
globalThis as unknown as GlobalExtension;
|