UNPKG

1.62 kBTypeScriptView Raw
1/// <reference types="node" />
2
3/** Prevent pipe breaking caused by errors from gulp plugins */
4
5/** Prevent pipe breaking caused by errors from gulp plugins */
6interface GulpPlumber {
7 /**
8 * Returns Stream, that fixes pipe methods on Streams that are next in pipeline.
9 *
10 * @param options Sets options as described in the Options interface
11 */
12 (options?: Options): NodeJS.ReadWriteStream;
13 /**
14 * Returns Stream, that fixes pipe methods on Streams that are next in pipeline.
15 *
16 * @param errorHandler the function to be attached to the stream on('error')
17 */
18 (errorHandler: ErrorHandlerFunction): NodeJS.ReadWriteStream;
19 /** returns default behaviour for pipeline after it was piped */
20 stop(): NodeJS.ReadWriteStream;
21}
22
23interface Options {
24 /**
25 * Handle errors in underlying streams and output them to console. Default true.
26 * If function passed, it will be attached to stream on('error')
27 * If false passed, error handler will not be attached
28 * If undefined passed, default error handler will be attached
29 */
30 errorHandler?: ErrorHandlerFunction | boolean | undefined;
31 /** Monkeypatch pipe functions in underlying streams in pipeline. Default true. */
32 inherit?: boolean | undefined;
33}
34
35/** an error handler function to be attached to the stream on('error') */
36interface ErrorHandlerFunction {
37 /** an error handler function to be attached to the stream on('error') */
38 (error: any): void;
39}
40
41/** Prevent pipe breaking caused by errors from gulp plugins */
42declare var gulpPlumber: GulpPlumber;
43
44export = gulpPlumber;