• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import { TaskFunction } from "gulp";
2
3declare module "gulp-insert" {
4    export function append(text: string | Buffer): NodeJS.ReadWriteStream;
5    export function prepend(text: string | Buffer): NodeJS.ReadWriteStream;
6    export function wrap(text: string | Buffer, tail: string | Buffer): NodeJS.ReadWriteStream;
7    export function transform(cb: (contents: string, file: {path: string, relative: string}) => string): NodeJS.ReadWriteStream; // file is a vinyl file
8}
9
10declare module "sorcery";
11
12declare module "vinyl" {
13    // NOTE: This makes it possible to correctly type vinyl Files under @ts-check.
14    export = File;
15
16    declare class File<T extends File.Contents = File.Contents> {
17        constructor(options?: File.VinylOptions<T>);
18
19        cwd: string;
20        base: string;
21        path: string;
22        readonly history: readonly string[];
23        contents: T;
24        relative: string;
25        dirname: string;
26        basename: string;
27        stem: string;
28        extname: string;
29        symlink: string | null;
30        stat: import("fs").Stats | null;
31        sourceMap?: import("./sourcemaps").RawSourceMap | string;
32
33        [custom: string]: any;
34
35        isBuffer(): this is T extends Buffer ? File<Buffer> : never;
36        isStream(): this is T extends NodeJS.ReadableStream ? File<NodeJS.ReadableStream> : never;
37        isNull(): this is T extends null ? File<null> : never;
38        isDirectory(): this is T extends null ? File.Directory : never;
39        isSymbolic(): this is T extends null ? File.Symbolic : never;
40        clone(opts?: { contents?: boolean, deep?: boolean }): this;
41    }
42
43    namespace File {
44        export interface VinylOptions<T extends Contents = Contents> {
45            cwd?: string;
46            base?: string;
47            path?: string;
48            history?: readonly string[];
49            stat?: import("fs").Stats;
50            contents?: T;
51            sourceMap?: import("./sourcemaps").RawSourceMap | string;
52            [custom: string]: any;
53        }
54
55        export type Contents = Buffer | NodeJS.ReadableStream | null;
56        export type File = import("./vinyl");
57        export type NullFile = File<null>;
58        export type BufferFile = File<Buffer>;
59        export type StreamFile = File<NodeJS.ReadableStream>;
60
61        export interface Directory extends NullFile {
62            isNull(): true;
63            isDirectory(): true;
64            isSymbolic(): this is never;
65        }
66
67        export interface Symbolic extends NullFile {
68            isNull(): true;
69            isDirectory(): this is never;
70            isSymbolic(): true;
71        }
72    }
73}
74
75declare module "undertaker" {
76    interface TaskFunctionParams {
77        flags?: Record<string, string>;
78    }
79    interface TaskFunctionWrapped {
80        description: string
81        flags: { [name: string]: string }
82    }
83}
84
85declare module "gulp-sourcemaps" {
86    interface WriteOptions {
87        destPath?: string;
88    }
89
90}
91