UNPKG

3.82 kBTypeScriptView Raw
1/// <reference types="node" />
2
3import vinyl = require("vinyl");
4import chalk from "chalk";
5import through2 = require("through2");
6
7export { vinyl as File };
8
9/**
10 * Replaces a file extension in a path. Returns the new path.
11 */
12export function replaceExtension(npath: string, ext: string): string;
13
14export const colors: typeof chalk;
15
16export const date: {
17 (now?: Date | string, mask?: string, convertLocalTimeToUTC?: boolean): any;
18 masks: any;
19};
20
21/**
22 * Logs stuff. Already prefixed with [gulp] and all that. Use the right colors
23 * for values. If you pass in multiple arguments it will join them by a space.
24 */
25export function log(message?: any, ...optionalParams: any[]): void;
26
27/**
28 * This is a lodash.template function wrapper. You must pass in a valid gulp
29 * file object so it is available to the user or it will error. You can not
30 * configure any of the delimiters. Look at the lodash docs for more info.
31 */
32export function template(tmpl: string): (opt: { file: { path: string } }) => string;
33export function template(tmpl: string, opt: { file: { path: string } }): string;
34
35export const env: any;
36
37export function beep(): void;
38
39/**
40 * Returns a stream that does nothing but pass data straight through.
41 */
42export const noop: typeof through2;
43
44export function isStream(obj: any): boolean;
45
46export function isBuffer(obj: any): boolean;
47
48export function isNull(obj: any): boolean;
49
50export const linefeed: string;
51
52export function combine(streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream;
53export function combine(...streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream;
54
55/**
56 * This is similar to es.wait but instead of buffering text into one string
57 * it buffers anything into an array (so very useful for file objects).
58 */
59export function buffer(cb?: (err: Error, data: any[]) => void): NodeJS.ReadWriteStream;
60
61export class PluginError implements Error, PluginErrorOptions {
62 constructor(options?: PluginErrorOptions);
63 constructor(pluginName: string, options?: PluginErrorOptions);
64 constructor(pluginName: string, message: string | Error, options?: PluginErrorOptions);
65 /**
66 * The module name of your plugin.
67 */
68 name: string;
69 /**
70 * Can be a string or an existing error.
71 */
72 message: any;
73 fileName: string;
74 lineNumber: number;
75 /**
76 * You need to include the message along with this stack. If you pass an
77 * error in as the message the stack will be pulled from that, otherwise one
78 * will be created.
79 */
80 stack: string;
81 /**
82 * By default the stack will not be shown. Set this to true if you think the
83 * stack is important for your error.
84 */
85 showStack: boolean;
86 /**
87 * Error properties will be included in err.toString(). Can be omitted by
88 * setting this to false.
89 */
90 showProperties: boolean;
91 plugin: string;
92 error: Error;
93}
94
95export interface PluginErrorOptions {
96 /**
97 * The module name of your plugin.
98 */
99 name?: string | undefined;
100 /**
101 * Can be a string or an existing error.
102 */
103 message?: any;
104 fileName?: string | undefined;
105 lineNumber?: number | undefined;
106 /**
107 * You need to include the message along with this stack. If you pass an
108 * error in as the message the stack will be pulled from that, otherwise one
109 * will be created.
110 */
111 stack?: string | undefined;
112 /**
113 * By default the stack will not be shown. Set this to true if you think the
114 * stack is important for your error.
115 */
116 showStack?: boolean | undefined;
117 /**
118 * Error properties will be included in err.toString(). Can be omitted by
119 * setting this to false.
120 */
121 showProperties?: boolean | undefined;
122 plugin?: string | undefined;
123 error?: Error | undefined;
124}