Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"polendina": "^3.2.21",
"semantic-release": "^25.0.3",
"standard": "^17.1.2",
"typescript": "^6.0.3"
"typescript": "^7.0.2"
},
"release": {
"branches": [
Expand Down
30 changes: 18 additions & 12 deletions types/through2.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/**
* @file Tiny utilities for inserting transformation logic into Node.js stream
* pipelines without subclassing `Transform`. Exports `transform`,
* `objectTransform`, `transformer`. See `through2/web` for the Web Streams
* variant.
*/
export type ClassicTransformFn = (chunk: any, encoding: BufferEncoding, callback: (err?: Error | null, data?: any) => void) => void;
export type AsyncTransformFn = (chunk: any, encoding: BufferEncoding) => any | Promise<any>;
export type AsyncGenTransformFn = (source: AsyncIterable<any>) => AsyncGenerator<any, void, void>;
export type TransformFn = ClassicTransformFn | AsyncTransformFn | AsyncGenTransformFn;
export type ClassicFlushFn = (callback: (err?: Error | null) => void) => void;
export type AsyncFlushFn = () => any | Promise<any>;
export type FlushFn = ClassicFlushFn | AsyncFlushFn;
export type TransformOptions = import('readable-stream').TransformOptions;
/**
* Build a Transform around a transformation function (classic / async / async
* generator; auto-dispatched).
Expand All @@ -23,7 +37,7 @@
* @param {FlushFn} [flushFn]
* @returns {import('readable-stream').Transform}
*/
export function transform(options?: TransformOptions | TransformFn, transformFn?: TransformFn, flushFn?: FlushFn): import("readable-stream").Transform;
export declare function transform(options?: TransformOptions | TransformFn, transformFn?: TransformFn, flushFn?: FlushFn): import('readable-stream').Transform;
/**
* Like {@link transform}, with `objectMode: true` by default.
*
Expand All @@ -44,7 +58,7 @@ export function transform(options?: TransformOptions | TransformFn, transformFn?
* @param {FlushFn} [flushFn]
* @returns {import('readable-stream').Transform}
*/
export function objectTransform(options?: TransformOptions | TransformFn, transformFn?: TransformFn, flushFn?: FlushFn): import("readable-stream").Transform;
export declare function objectTransform(options?: TransformOptions | TransformFn, transformFn?: TransformFn, flushFn?: FlushFn): import('readable-stream').Transform;
/**
* Build a reusable factory. The returned function works with or without
* `new`; per-call options merge over the configured defaults and are exposed
Expand All @@ -67,18 +81,9 @@ export function objectTransform(options?: TransformOptions | TransformFn, transf
* @param {FlushFn} [flushFn]
* @returns {(override?: TransformOptions) => import('readable-stream').Transform & { options: TransformOptions }}
*/
export function transformer(options?: TransformOptions | TransformFn, transformFn?: TransformFn, flushFn?: FlushFn): (override?: TransformOptions) => import("readable-stream").Transform & {
export declare function transformer(options?: TransformOptions | TransformFn, transformFn?: TransformFn, flushFn?: FlushFn): (override?: TransformOptions) => import('readable-stream').Transform & {
options: TransformOptions;
};
export default through2;
export type ClassicTransformFn = (chunk: any, encoding: BufferEncoding, callback: (err?: Error | null, data?: any) => void) => void;
export type AsyncTransformFn = (chunk: any, encoding: BufferEncoding) => any | Promise<any>;
export type AsyncGenTransformFn = (source: AsyncIterable<any>) => AsyncGenerator<any, void, void>;
export type TransformFn = ClassicTransformFn | AsyncTransformFn | AsyncGenTransformFn;
export type ClassicFlushFn = (callback: (err?: Error | null) => void) => void;
export type AsyncFlushFn = () => any | Promise<any>;
export type FlushFn = ClassicFlushFn | AsyncFlushFn;
export type TransformOptions = import("readable-stream").TransformOptions;
/**
* Default export: `transform` with legacy `.obj` / `.ctor` for v4
* back-compatibility.
Expand All @@ -88,4 +93,5 @@ declare const through2: typeof transform & {
obj: typeof objectTransform;
ctor: typeof transformer;
};
export default through2;
//# sourceMappingURL=through2.d.ts.map
2 changes: 1 addition & 1 deletion types/through2.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions types/web.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/**
* @file Tiny utility for inserting transformation logic into Web Streams
* pipelines. Returns `TransformStream` instances; zero runtime dependencies;
* runs anywhere `TransformStream` is a global (modern browsers, Node.js,
* Deno, Bun, Cloudflare Workers). See the root `through2` entry for the
* Node.js streams variant.
*/
export type ClassicWebTransformFn = (chunk: any, controller: TransformStreamDefaultController<any>) => void;
export type AsyncWebTransformFn = (chunk: any) => any | Promise<any>;
export type AsyncGenWebTransformFn = (source: AsyncIterable<any>) => AsyncGenerator<any, void, void>;
export type WebTransformFn = ClassicWebTransformFn | AsyncWebTransformFn | AsyncGenWebTransformFn;
export type ClassicWebFlushFn = (controller: TransformStreamDefaultController<any>) => void;
export type AsyncWebFlushFn = () => any | Promise<any>;
export type WebFlushFn = ClassicWebFlushFn | AsyncWebFlushFn;
/**
* Build a TransformStream around a transformation function (classic /
* async / async generator; auto-dispatched).
Expand Down Expand Up @@ -27,16 +41,9 @@
* @param {WebFlushFn} [flushFn]
* @returns {{ readable: ReadableStream<any>, writable: WritableStream<any> }}
*/
export function transform(transformFn?: WebTransformFn, flushFn?: WebFlushFn): {
export declare function transform(transformFn?: WebTransformFn, flushFn?: WebFlushFn): {
readable: ReadableStream<any>;
writable: WritableStream<any>;
};
export default transform;
export type ClassicWebTransformFn = (chunk: any, controller: TransformStreamDefaultController<any>) => void;
export type AsyncWebTransformFn = (chunk: any) => any | Promise<any>;
export type AsyncGenWebTransformFn = (source: AsyncIterable<any>) => AsyncGenerator<any, void, void>;
export type WebTransformFn = ClassicWebTransformFn | AsyncWebTransformFn | AsyncGenWebTransformFn;
export type ClassicWebFlushFn = (controller: TransformStreamDefaultController<any>) => void;
export type AsyncWebFlushFn = () => any | Promise<any>;
export type WebFlushFn = ClassicWebFlushFn | AsyncWebFlushFn;
//# sourceMappingURL=web.d.ts.map
2 changes: 1 addition & 1 deletion types/web.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.