web-utility-streams 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +470 -2
- package/lib/ConcatStream.d.mts +22 -0
- package/lib/ConcatStream.mjs +67 -0
- package/lib/DebugStream.d.mts +3 -0
- package/lib/DebugStream.mjs +12 -0
- package/lib/DeferredStream.d.mts +16 -0
- package/lib/DeferredStream.mjs +51 -0
- package/lib/EmptyStream.d.mts +3 -0
- package/lib/EmptyStream.mjs +9 -0
- package/lib/EventSourceDecoderStream.d.mts +39 -0
- package/lib/EventSourceDecoderStream.mjs +106 -0
- package/lib/EventSourceEncoderStream.d.mts +34 -0
- package/lib/EventSourceEncoderStream.mjs +57 -0
- package/lib/FilterMapStream.d.mts +8 -0
- package/lib/FilterMapStream.mjs +19 -0
- package/lib/FilterStream.d.mts +4 -0
- package/lib/FilterStream.mjs +9 -0
- package/lib/JsonDecoderStream.d.mts +63 -0
- package/lib/JsonDecoderStream.mjs +121 -0
- package/lib/JsonEncoderStream.d.mts +51 -0
- package/lib/JsonEncoderStream.mjs +96 -0
- package/lib/JsonTokenDecoderStream.d.mts +49 -0
- package/lib/JsonTokenDecoderStream.mjs +62 -0
- package/lib/JsonTokenizer-BtRpnxKn.mjs +299 -0
- package/lib/LazyStream.d.mts +18 -0
- package/lib/LazyStream.mjs +53 -0
- package/lib/LineEndings-CET4b2lJ.d.mts +5 -0
- package/lib/LineSplitter-CPGPZH7w.mjs +64 -0
- package/lib/MapStream.d.mts +7 -0
- package/lib/MapStream.mjs +18 -0
- package/lib/NewlineDelimitedJsonDecoderStream.d.mts +18 -0
- package/lib/NewlineDelimitedJsonDecoderStream.mjs +48 -0
- package/lib/NewlineDelimitedJsonEncoderStream.d.mts +15 -0
- package/lib/NewlineDelimitedJsonEncoderStream.mjs +16 -0
- package/lib/SplitLinesStream.d.mts +8 -0
- package/lib/SplitLinesStream.mjs +24 -0
- package/lib/TransformPipelineStream.d.mts +7 -0
- package/lib/TransformPipelineStream.mjs +17 -0
- package/lib/UnionStream.d.mts +21 -0
- package/lib/UnionStream.mjs +79 -0
- package/lib/consumers.d.mts +26 -0
- package/lib/consumers.mjs +92 -0
- package/lib/isPromiseLike-SjGgF7zP.mjs +9 -0
- package/lib/readableStreamToGenerator.d.mts +8 -0
- package/lib/readableStreamToGenerator.mjs +64 -0
- package/package.json +127 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/TransformPipelineStream.ts
|
|
2
|
+
var TransformPipelineStream = class {
|
|
3
|
+
writable;
|
|
4
|
+
readable;
|
|
5
|
+
constructor(buildPipeline) {
|
|
6
|
+
let writable;
|
|
7
|
+
const readable = buildPipeline({ pipeThrough: (firstTransform) => {
|
|
8
|
+
if (writable !== void 0) throw new Error("Cannot pipe the input multiple times");
|
|
9
|
+
writable = firstTransform.writable;
|
|
10
|
+
return firstTransform.readable;
|
|
11
|
+
} });
|
|
12
|
+
if (writable === void 0) throw new Error("The function passed to `new TransformPipelineStream(...)` must call input.pipeThrough");
|
|
13
|
+
this.writable = writable;
|
|
14
|
+
this.readable = readable;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export { TransformPipelineStream as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type UnionStreamEvent<T extends readonly ReadableStream[]> = T[number] extends ReadableStream<infer U> ? U : never;
|
|
2
|
+
/**
|
|
3
|
+
* Merge events from multiple source streams into a single output stream.
|
|
4
|
+
* Whenever reading, always read from all streams in parallel.
|
|
5
|
+
*
|
|
6
|
+
* Backpressure is handled, so if you pause reading from the output, we
|
|
7
|
+
* will also pause reading from the source streams.
|
|
8
|
+
*
|
|
9
|
+
* The output closes once all source streams have closed. If any source stream
|
|
10
|
+
* errors, the output is errored and all other source streams are cancelled.
|
|
11
|
+
* If the output is cancelled, all source streams are cancelled.
|
|
12
|
+
*
|
|
13
|
+
* The optional `queuingStrategy` controls how far ahead of the reader the
|
|
14
|
+
* source streams are read. By default, one chunk is read ahead. With
|
|
15
|
+
* `{ highWaterMark: 0 }`, the sources are only read when the output is read.
|
|
16
|
+
* Because the sources are read in parallel, the output can buffer one more
|
|
17
|
+
* chunk per source than the high water mark allows.
|
|
18
|
+
*/
|
|
19
|
+
export default class UnionStream<const T extends readonly ReadableStream[]> extends ReadableStream<UnionStreamEvent<T>> {
|
|
20
|
+
constructor(streams: T, queuingStrategy?: QueuingStrategy<UnionStreamEvent<T>>);
|
|
21
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/UnionStream.ts
|
|
2
|
+
/**
|
|
3
|
+
* Merge events from multiple source streams into a single output stream.
|
|
4
|
+
* Whenever reading, always read from all streams in parallel.
|
|
5
|
+
*
|
|
6
|
+
* Backpressure is handled, so if you pause reading from the output, we
|
|
7
|
+
* will also pause reading from the source streams.
|
|
8
|
+
*
|
|
9
|
+
* The output closes once all source streams have closed. If any source stream
|
|
10
|
+
* errors, the output is errored and all other source streams are cancelled.
|
|
11
|
+
* If the output is cancelled, all source streams are cancelled.
|
|
12
|
+
*
|
|
13
|
+
* The optional `queuingStrategy` controls how far ahead of the reader the
|
|
14
|
+
* source streams are read. By default, one chunk is read ahead. With
|
|
15
|
+
* `{ highWaterMark: 0 }`, the sources are only read when the output is read.
|
|
16
|
+
* Because the sources are read in parallel, the output can buffer one more
|
|
17
|
+
* chunk per source than the high water mark allows.
|
|
18
|
+
*/
|
|
19
|
+
var UnionStream = class extends ReadableStream {
|
|
20
|
+
constructor(streams, queuingStrategy) {
|
|
21
|
+
let controller;
|
|
22
|
+
let isFinished = false;
|
|
23
|
+
let activeReads = 0;
|
|
24
|
+
const onError = (err) => {
|
|
25
|
+
activeReads--;
|
|
26
|
+
if (isFinished) return;
|
|
27
|
+
isFinished = true;
|
|
28
|
+
controller.error(err);
|
|
29
|
+
cancelAll(err).catch(() => {});
|
|
30
|
+
};
|
|
31
|
+
const sources = streams.map((stream) => {
|
|
32
|
+
const source = {
|
|
33
|
+
reader: stream.getReader(),
|
|
34
|
+
onResult: (result) => {
|
|
35
|
+
activeReads--;
|
|
36
|
+
if (isFinished) return;
|
|
37
|
+
if (result.done) {
|
|
38
|
+
if (!idleSources.length && !activeReads) {
|
|
39
|
+
isFinished = true;
|
|
40
|
+
controller.close();
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
idleSources.push(source);
|
|
44
|
+
controller.enqueue(result.value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return source;
|
|
49
|
+
});
|
|
50
|
+
let idleSources = sources;
|
|
51
|
+
const cancelAll = async (reason) => {
|
|
52
|
+
const results = await Promise.allSettled(sources.map((source) => source.reader.cancel(reason)));
|
|
53
|
+
for (const result of results) if (result.status === "rejected") throw result.reason;
|
|
54
|
+
};
|
|
55
|
+
super({
|
|
56
|
+
start(c) {
|
|
57
|
+
controller = c;
|
|
58
|
+
if (!sources.length) {
|
|
59
|
+
isFinished = true;
|
|
60
|
+
controller.close();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
pull() {
|
|
64
|
+
const readers = idleSources;
|
|
65
|
+
idleSources = [];
|
|
66
|
+
for (const source of readers) {
|
|
67
|
+
activeReads++;
|
|
68
|
+
source.reader.read().then(source.onResult, onError);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
async cancel(reason) {
|
|
72
|
+
if (isFinished) return;
|
|
73
|
+
isFinished = true;
|
|
74
|
+
await cancelAll(reason);
|
|
75
|
+
}
|
|
76
|
+
}, queuingStrategy);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export { UnionStream as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A chunk that can be consumed. Strings are treated as text, and everything
|
|
3
|
+
* else is treated as bytes (UTF-8 encoded text, when consuming as text).
|
|
4
|
+
*/
|
|
5
|
+
export type ConsumableChunk = string | ArrayBuffer | ArrayBufferView;
|
|
6
|
+
/**
|
|
7
|
+
* A stream that can be consumed. Either a web `ReadableStream`, or any async
|
|
8
|
+
* iterable (e.g. a Node.js `Readable` stream).
|
|
9
|
+
*/
|
|
10
|
+
export type ConsumableStream = ReadableStream<ConsumableChunk> | AsyncIterable<ConsumableChunk>;
|
|
11
|
+
/**
|
|
12
|
+
* Read the entire stream, and decode its contents as UTF-8 text. If the stream
|
|
13
|
+
* starts with bytes, a leading UTF-8 byte order mark is removed (string chunks
|
|
14
|
+
* are used as they are). Rejects if the stream errors.
|
|
15
|
+
*/
|
|
16
|
+
export declare function textFromStream(stream: ConsumableStream): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Read the entire stream, decode its contents as UTF-8 text, and parse it as
|
|
19
|
+
* JSON. Rejects if the stream errors or the text is not valid JSON.
|
|
20
|
+
*/
|
|
21
|
+
export declare function jsonFromStream(stream: ConsumableStream): Promise<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Read the entire stream into a single `Uint8Array`. String chunks are UTF-8
|
|
24
|
+
* encoded. Rejects if the stream errors.
|
|
25
|
+
*/
|
|
26
|
+
export declare function bytesFromStream(stream: ConsumableStream): Promise<Uint8Array>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// src/consumers.ts
|
|
2
|
+
const encoder = new TextEncoder();
|
|
3
|
+
/**
|
|
4
|
+
* Read the entire stream, and decode its contents as UTF-8 text. If the stream
|
|
5
|
+
* starts with bytes, a leading UTF-8 byte order mark is removed (string chunks
|
|
6
|
+
* are used as they are). Rejects if the stream errors.
|
|
7
|
+
*/
|
|
8
|
+
async function textFromStream(stream) {
|
|
9
|
+
const chunks = stream[Symbol.asyncIterator]();
|
|
10
|
+
const firstChunk = await chunks.next();
|
|
11
|
+
if (firstChunk.done) return "";
|
|
12
|
+
try {
|
|
13
|
+
if (typeof firstChunk.value === "string") return await textFromStreamOfStrings(chunks, firstChunk.value);
|
|
14
|
+
return await textFromStreamOfBytes(chunks, toUint8Array(firstChunk.value));
|
|
15
|
+
} catch (ex) {
|
|
16
|
+
try {
|
|
17
|
+
await chunks.return?.();
|
|
18
|
+
} catch {}
|
|
19
|
+
throw ex;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function textFromStreamOfStrings(stream, firstChunk) {
|
|
23
|
+
let decoder;
|
|
24
|
+
let decoderHasBytes = false;
|
|
25
|
+
let result = firstChunk;
|
|
26
|
+
let next = await stream.next();
|
|
27
|
+
while (!next.done) {
|
|
28
|
+
if (typeof next.value === "string") {
|
|
29
|
+
if (decoderHasBytes) {
|
|
30
|
+
result += decoder.decode();
|
|
31
|
+
decoderHasBytes = false;
|
|
32
|
+
}
|
|
33
|
+
result += next.value;
|
|
34
|
+
} else {
|
|
35
|
+
decoder ??= new TextDecoder("utf-8", { ignoreBOM: true });
|
|
36
|
+
result += decoder.decode(toUint8Array(next.value), { stream: true });
|
|
37
|
+
decoderHasBytes = true;
|
|
38
|
+
}
|
|
39
|
+
next = await stream.next();
|
|
40
|
+
}
|
|
41
|
+
if (!decoderHasBytes) return result;
|
|
42
|
+
return result + decoder.decode();
|
|
43
|
+
}
|
|
44
|
+
async function textFromStreamOfBytes(stream, firstChunk) {
|
|
45
|
+
const result = [firstChunk];
|
|
46
|
+
let length = firstChunk.byteLength;
|
|
47
|
+
let next = await stream.next();
|
|
48
|
+
while (!next.done) {
|
|
49
|
+
const bytes = typeof next.value === "string" ? encoder.encode(next.value) : toUint8Array(next.value);
|
|
50
|
+
result.push(bytes);
|
|
51
|
+
length += bytes.byteLength;
|
|
52
|
+
next = await stream.next();
|
|
53
|
+
}
|
|
54
|
+
return new TextDecoder().decode(concatChunks(length, result));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Read the entire stream, decode its contents as UTF-8 text, and parse it as
|
|
58
|
+
* JSON. Rejects if the stream errors or the text is not valid JSON.
|
|
59
|
+
*/
|
|
60
|
+
async function jsonFromStream(stream) {
|
|
61
|
+
return JSON.parse(await textFromStream(stream));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Read the entire stream into a single `Uint8Array`. String chunks are UTF-8
|
|
65
|
+
* encoded. Rejects if the stream errors.
|
|
66
|
+
*/
|
|
67
|
+
async function bytesFromStream(stream) {
|
|
68
|
+
const chunks = [];
|
|
69
|
+
let length = 0;
|
|
70
|
+
for await (const chunk of stream) {
|
|
71
|
+
const bytes = typeof chunk === "string" ? encoder.encode(chunk) : toUint8Array(chunk);
|
|
72
|
+
chunks.push(bytes);
|
|
73
|
+
length += bytes.byteLength;
|
|
74
|
+
}
|
|
75
|
+
return concatChunks(length, chunks);
|
|
76
|
+
}
|
|
77
|
+
function concatChunks(length, chunks) {
|
|
78
|
+
const result = new Uint8Array(length);
|
|
79
|
+
let offset = 0;
|
|
80
|
+
for (const chunk of chunks) {
|
|
81
|
+
result.set(chunk, offset);
|
|
82
|
+
offset += chunk.byteLength;
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
function toUint8Array(chunk) {
|
|
87
|
+
if (chunk instanceof Uint8Array) return chunk;
|
|
88
|
+
if (chunk instanceof ArrayBuffer) return new Uint8Array(chunk);
|
|
89
|
+
if (ArrayBuffer.isView(chunk)) return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
90
|
+
throw new TypeError(`Expected each chunk to be a string, ArrayBuffer or ArrayBufferView, but got ${chunk === null ? "null" : typeof chunk}`);
|
|
91
|
+
}
|
|
92
|
+
export { bytesFromStream, jsonFromStream, textFromStream };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/internal/isPromiseLike.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a value is a promise, or any other "thenable" that `await` would
|
|
4
|
+
* wait for.
|
|
5
|
+
*/
|
|
6
|
+
function isPromiseLike(value) {
|
|
7
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
8
|
+
}
|
|
9
|
+
export { isPromiseLike as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a ReadableStream into an AsyncGenerator. This implementation
|
|
3
|
+
* also ensures that calls to `return()` and `throw()` on the generator will immediately cancel the underlying
|
|
4
|
+
* stream. This is important for GraphQL subscriptions to ensure that resources are cleaned up promptly
|
|
5
|
+
* when a client disconnects. The default implementation of AsyncIterable returned by ReadableStream does not
|
|
6
|
+
* do this correctly.
|
|
7
|
+
*/
|
|
8
|
+
export default function readableStreamToGenerator<TEvent>(stream: ReadableStream<TEvent>): AsyncGenerator<TEvent, void>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/readableStreamToGenerator.ts
|
|
2
|
+
const DONE_RESULT = {
|
|
3
|
+
done: true,
|
|
4
|
+
value: void 0
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Convert a ReadableStream into an AsyncGenerator. This implementation
|
|
8
|
+
* also ensures that calls to `return()` and `throw()` on the generator will immediately cancel the underlying
|
|
9
|
+
* stream. This is important for GraphQL subscriptions to ensure that resources are cleaned up promptly
|
|
10
|
+
* when a client disconnects. The default implementation of AsyncIterable returned by ReadableStream does not
|
|
11
|
+
* do this correctly.
|
|
12
|
+
*/
|
|
13
|
+
function readableStreamToGenerator(stream) {
|
|
14
|
+
const reader = stream.getReader();
|
|
15
|
+
let finished = false;
|
|
16
|
+
const finish = () => {
|
|
17
|
+
if (finished) return;
|
|
18
|
+
finished = true;
|
|
19
|
+
reader.releaseLock();
|
|
20
|
+
};
|
|
21
|
+
const cancel = async (reason) => {
|
|
22
|
+
if (finished) return;
|
|
23
|
+
finished = true;
|
|
24
|
+
try {
|
|
25
|
+
await reader.cancel(reason);
|
|
26
|
+
} finally {
|
|
27
|
+
reader.releaseLock();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const onResult = (result) => {
|
|
31
|
+
if (result.done) {
|
|
32
|
+
finish();
|
|
33
|
+
return DONE_RESULT;
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
const onError = (err) => {
|
|
38
|
+
finish();
|
|
39
|
+
throw err;
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
next() {
|
|
43
|
+
if (finished) return Promise.resolve(DONE_RESULT);
|
|
44
|
+
return reader.read().then(onResult, onError);
|
|
45
|
+
},
|
|
46
|
+
async return() {
|
|
47
|
+
await cancel();
|
|
48
|
+
return DONE_RESULT;
|
|
49
|
+
},
|
|
50
|
+
async throw(err) {
|
|
51
|
+
try {
|
|
52
|
+
await cancel(err);
|
|
53
|
+
} catch {}
|
|
54
|
+
throw err;
|
|
55
|
+
},
|
|
56
|
+
[Symbol.asyncIterator]() {
|
|
57
|
+
return this;
|
|
58
|
+
},
|
|
59
|
+
async [Symbol.asyncDispose]() {
|
|
60
|
+
await cancel();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export { readableStreamToGenerator as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,129 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-utility-streams",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Various utility streams that are very useful for working with web streams.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./ConcatStream": {
|
|
8
|
+
"types": "./lib/ConcatStream.d.mts",
|
|
9
|
+
"default": "./lib/ConcatStream.mjs"
|
|
10
|
+
},
|
|
11
|
+
"./consumers": {
|
|
12
|
+
"types": "./lib/consumers.d.mts",
|
|
13
|
+
"default": "./lib/consumers.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./DebugStream": {
|
|
16
|
+
"types": "./lib/DebugStream.d.mts",
|
|
17
|
+
"default": "./lib/DebugStream.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./DeferredStream": {
|
|
20
|
+
"types": "./lib/DeferredStream.d.mts",
|
|
21
|
+
"default": "./lib/DeferredStream.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./EmptyStream": {
|
|
24
|
+
"types": "./lib/EmptyStream.d.mts",
|
|
25
|
+
"default": "./lib/EmptyStream.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./EventSourceDecoderStream": {
|
|
28
|
+
"types": "./lib/EventSourceDecoderStream.d.mts",
|
|
29
|
+
"default": "./lib/EventSourceDecoderStream.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./EventSourceEncoderStream": {
|
|
32
|
+
"types": "./lib/EventSourceEncoderStream.d.mts",
|
|
33
|
+
"default": "./lib/EventSourceEncoderStream.mjs"
|
|
34
|
+
},
|
|
35
|
+
"./FilterMapStream": {
|
|
36
|
+
"types": "./lib/FilterMapStream.d.mts",
|
|
37
|
+
"default": "./lib/FilterMapStream.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./FilterStream": {
|
|
40
|
+
"types": "./lib/FilterStream.d.mts",
|
|
41
|
+
"default": "./lib/FilterStream.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./JsonDecoderStream": {
|
|
44
|
+
"types": "./lib/JsonDecoderStream.d.mts",
|
|
45
|
+
"default": "./lib/JsonDecoderStream.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./JsonEncoderStream": {
|
|
48
|
+
"types": "./lib/JsonEncoderStream.d.mts",
|
|
49
|
+
"default": "./lib/JsonEncoderStream.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./JsonTokenDecoderStream": {
|
|
52
|
+
"types": "./lib/JsonTokenDecoderStream.d.mts",
|
|
53
|
+
"default": "./lib/JsonTokenDecoderStream.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./LazyStream": {
|
|
56
|
+
"types": "./lib/LazyStream.d.mts",
|
|
57
|
+
"default": "./lib/LazyStream.mjs"
|
|
58
|
+
},
|
|
59
|
+
"./MapStream": {
|
|
60
|
+
"types": "./lib/MapStream.d.mts",
|
|
61
|
+
"default": "./lib/MapStream.mjs"
|
|
62
|
+
},
|
|
63
|
+
"./NewlineDelimitedJsonDecoderStream": {
|
|
64
|
+
"types": "./lib/NewlineDelimitedJsonDecoderStream.d.mts",
|
|
65
|
+
"default": "./lib/NewlineDelimitedJsonDecoderStream.mjs"
|
|
66
|
+
},
|
|
67
|
+
"./NewlineDelimitedJsonEncoderStream": {
|
|
68
|
+
"types": "./lib/NewlineDelimitedJsonEncoderStream.d.mts",
|
|
69
|
+
"default": "./lib/NewlineDelimitedJsonEncoderStream.mjs"
|
|
70
|
+
},
|
|
71
|
+
"./readableStreamToGenerator": {
|
|
72
|
+
"types": "./lib/readableStreamToGenerator.d.mts",
|
|
73
|
+
"default": "./lib/readableStreamToGenerator.mjs"
|
|
74
|
+
},
|
|
75
|
+
"./SplitLinesStream": {
|
|
76
|
+
"types": "./lib/SplitLinesStream.d.mts",
|
|
77
|
+
"default": "./lib/SplitLinesStream.mjs"
|
|
78
|
+
},
|
|
79
|
+
"./TransformPipelineStream": {
|
|
80
|
+
"types": "./lib/TransformPipelineStream.d.mts",
|
|
81
|
+
"default": "./lib/TransformPipelineStream.mjs"
|
|
82
|
+
},
|
|
83
|
+
"./UnionStream": {
|
|
84
|
+
"types": "./lib/UnionStream.d.mts",
|
|
85
|
+
"default": "./lib/UnionStream.mjs"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"files": [
|
|
89
|
+
"lib/"
|
|
90
|
+
],
|
|
91
|
+
"allowScripts": {
|
|
92
|
+
"fsevents@2.3.3": true
|
|
93
|
+
},
|
|
94
|
+
"devDependencies": {
|
|
95
|
+
"@microsoft/fetch-event-source": "^2.0.1",
|
|
96
|
+
"@streamparser/json": "^0.0.26",
|
|
97
|
+
"@streamparser/json-whatwg": "^0.0.26",
|
|
98
|
+
"@types/jsonstream": "^0.8.33",
|
|
99
|
+
"@types/ndjson": "^2.0.4",
|
|
100
|
+
"@types/node": "^24.19.2",
|
|
101
|
+
"@types/split2": "^4.2.3",
|
|
102
|
+
"bfj": "^9.1.4",
|
|
103
|
+
"eventsource-encoder": "^1.0.2",
|
|
104
|
+
"eventsource-parser": "^4.1.3",
|
|
105
|
+
"JSONStream": "^1.3.5",
|
|
106
|
+
"ndjson": "^2.0.0",
|
|
107
|
+
"prettier": "^3.10.1",
|
|
108
|
+
"split2": "^4.2.0",
|
|
109
|
+
"stream-chain": "^4.4.2",
|
|
110
|
+
"stream-json": "^3.9.0",
|
|
111
|
+
"tsdown": "^0.23.7",
|
|
112
|
+
"typescript": "^7.0.2",
|
|
113
|
+
"vitest": "^5.1.0"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"build": "tsdown",
|
|
117
|
+
"typecheck": "tsc --noEmit",
|
|
118
|
+
"typecheck:bench": "npm run build && tsc --noEmit -p benchmarks",
|
|
119
|
+
"test": "vitest run",
|
|
120
|
+
"format": "prettier --write .",
|
|
121
|
+
"format:check": "prettier --check .",
|
|
122
|
+
"bench": "npm run build && node benchmarks/run.ts"
|
|
123
|
+
},
|
|
124
|
+
"repository": {
|
|
125
|
+
"type": "git",
|
|
126
|
+
"url": "git+https://github.com/ForbesLindesay/web-utility-streams.git"
|
|
127
|
+
},
|
|
128
|
+
"license": "MIT"
|
|
129
|
+
}
|