UNPKG

mini-preproc

Version:

A simple, light, and fast text preprocessor implemented as a node transform stream.

30 lines (29 loc) 897 B
/// <reference types="node" /> import stream from 'stream'; declare class MiniPreprocError extends Error { constructor(msg: string); } declare type Defs = Record<string, boolean>; interface Opts { strip: boolean; } declare class State { defs: Defs; opts: Opts; done: boolean; ifActive: boolean; ifTrue: boolean; constructor(defs: Defs, opts?: Opts); isDone(): boolean; doLine(linein: string): string | null; } declare class MiniPreprocTransform extends stream.Transform { _state: State; _leftover: string; constructor(defs: Defs, opts: Opts); _transform(chunk: any, _enc: any, callback: (e?: Error) => void): void; _flush(callback: () => void): void; } declare function createPreprocStream(defs: Defs, opts: Opts): MiniPreprocTransform; export type { MiniPreprocError, Defs, Opts, MiniPreprocTransform }; export { createPreprocStream };