///
import {Duplex, DuplexOptions} from 'node:stream';
import type {Flushable} from 'stream-chain/defs.js';
import type {ParserOptions, Token} from '../core/parser.js';
/**
* Creates a pipeline of `parser()` piped into a component created by `fn`.
*
* Node-flavored entry: the returned factory has both `withParser.asStream(...)`
* (Node Duplex) and `withParser.asWebStream(...)` (Web `{readable, writable}` pair) attached.
*
* Generic in `O` (the shape of `fn`'s options, inferred from `fn`) and `T`
* (the downstream component's per-chunk output, inferred from `fn`'s return).
* `NoInfer` on `options` biases inference toward `fn` so a typed factory
* isn't overridden by an inline options literal.
*
* @param fn - A factory function that takes options and returns a stream component.
* @param options - Shared options passed to both the parser and `fn`.
*/
declare function withParser(fn: (options?: O) => Flushable, options?: NoInfer & ParserOptions): Flushable;
declare namespace withParser {
/** Same as `withParser()` but returns the pipeline wrapped as a Node Duplex stream. */
export function asStream(fn: (options?: O) => Flushable, options?: NoInfer & ParserOptions & DuplexOptions): Duplex;
/** Same as `withParser()` but returns the pipeline wrapped as a Web `TransformStream`-shaped pair. */
export function asWebStream(
fn: (options?: O) => Flushable,
options?: NoInfer & ParserOptions
): {readable: ReadableStream; writable: WritableStream};
/** Self-reference for `withParser.withParser === withParser`. */
export const withParser: typeof import('./with-parser.js').default;
}
export default withParser;
export {withParser};