UNPKG

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