1 |
|
2 |
|
3 | declare global {
|
4 | namespace NodeJS {
|
5 | interface WritableStream {
|
6 | write(buffer: any, cb?: (err?: Error | null) => void): boolean;
|
7 | }
|
8 | }
|
9 | }
|
10 |
|
11 | import * as _events from "events";
|
12 | import * as globStream from "glob-stream";
|
13 | import * as File from "vinyl";
|
14 |
|
15 | export interface SrcOptions extends globStream.Options {
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | buffer?: boolean | ((file: File) => boolean) | undefined;
|
22 |
|
23 | /**
|
24 | * Setting this to false will ignore the contents of the file and disable
|
25 | * writing to disk to speed up operations
|
26 | * Default: true
|
27 | */
|
28 | read?: boolean | ((file: File) => boolean) | undefined;
|
29 |
|
30 | /** Only find files that have been modified since the time specified */
|
31 | since?: Date | number | ((file: File) => Date | number) | undefined;
|
32 |
|
33 | /**
|
34 | * Causes the BOM to be removed on UTF-8 encoded files. Set to false if you need the BOM for some reason.
|
35 | * Default: true
|
36 | */
|
37 | removeBOM?: boolean | ((file: File) => boolean) | undefined;
|
38 |
|
39 | /** Optionally transcode from the given encoding. The default is 'utf8'. */
|
40 | encoding?: string | false | ((file: File) => string | false) | undefined;
|
41 |
|
42 | /**
|
43 | * Setting this to true will enable sourcemaps.
|
44 | * Default: false
|
45 | */
|
46 | sourcemaps?: boolean | ((file: File) => boolean) | undefined;
|
47 |
|
48 | /**
|
49 | * Whether or not to recursively resolve symlinks to their targets. Setting to false to
|
50 | * preserve them as symlinks and make file.symlink equal the original symlink's target path.
|
51 | * Default: false
|
52 | */
|
53 | resolveSymlinks?: boolean | ((file: File) => boolean) | undefined;
|
54 | }
|
55 |
|
56 | export interface DestOptions {
|
57 | /**
|
58 | * Specify the working directory the folder is relative to
|
59 | * Default is process.cwd()
|
60 | */
|
61 | cwd?: string | ((file: File) => string) | undefined;
|
62 |
|
63 | /**
|
64 | * Specify the mode the files should be created with
|
65 | * Default is the mode of the input file (file.stat.mode)
|
66 | * or the process mode if the input file has no mode property
|
67 | */
|
68 | mode?: number | ((file: File) => number) | undefined;
|
69 |
|
70 | /** Specify the mode the directory should be created with. Default is the process mode */
|
71 | dirMode?: number | ((file: File) => number) | undefined;
|
72 |
|
73 | /** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */
|
74 | overwrite?: boolean | ((file: File) => boolean) | undefined;
|
75 |
|
76 | /** Whether or not new data should be appended after existing file contents (if any). Default is false, to always replace existing contents */
|
77 | append?: boolean | ((file: File) => boolean) | undefined;
|
78 |
|
79 | /** Optionally transcode to the given encoding. The default is 'utf8'. */
|
80 | encoding?: string | false | ((file: File) => string | false) | undefined;
|
81 |
|
82 | /**
|
83 | * Enables sourcemap support on files passed through the stream. Will write inline soucemaps if
|
84 | * specified as true. Specifying a string path will write external sourcemaps at the given path.
|
85 | */
|
86 | sourcemaps?: boolean | string | ((file: File) => string | false | undefined) | undefined;
|
87 |
|
88 | /**
|
89 | * When creating a symlink, whether or not the created symlink should be relative. If false,
|
90 | * the symlink will be absolute. Note: This option will be ignored if a junction is being created.
|
91 | */
|
92 | relativeSymlinks?: boolean | ((file: File) => boolean) | undefined;
|
93 |
|
94 | /* When creating a symlink, whether or not a directory symlink should be created as a junction. */
|
95 | useJunctions?: boolean | ((file: File) => boolean) | undefined;
|
96 | }
|
97 |
|
98 | /**
|
99 | * Gets files that match the glob and converts them into the vinyl format
|
100 | * @param globs Takes a glob string or an array of glob strings as the first argument
|
101 | * Globs are executed in order, so negations should follow positive globs
|
102 | * fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
|
103 | * @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream
|
104 | */
|
105 | export function src(globs: string | string[], opt?: SrcOptions): NodeJS.ReadWriteStream;
|
106 |
|
107 | /**
|
108 | * On write the stream will save the vinyl File to disk at the folder/cwd specified.
|
109 | * After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
|
110 | * The file will be modified after being written to this stream:
|
111 | * cwd, base, and path will be overwritten to match the folder
|
112 | * stat.mode will be overwritten if you used a mode parameter
|
113 | * contents will have it's position reset to the beginning if it is a stream
|
114 | * @param folder destination folder or a function that takes in a file and returns a folder path
|
115 | */
|
116 | export function dest(folder: string | ((file: File) => string), opt?: DestOptions): NodeJS.ReadWriteStream;
|
117 |
|
118 | /**
|
119 | * On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified.
|
120 | * After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
|
121 | * The file will be modified after being written to this stream:
|
122 | * cwd, base, and path will be overwritten to match the folder
|
123 | */
|
124 | export function symlink(folder: string | ((File: File) => string), opts?: {
|
125 | |
126 |
|
127 |
|
128 |
|
129 | cwd?: string | ((file: File) => string) | undefined;
|
130 |
|
131 | |
132 |
|
133 |
|
134 |
|
135 | dirMode?: number | ((file: File) => number) | undefined;
|
136 |
|
137 |
|
138 | overwrite?: boolean | ((file: File) => boolean) | undefined;
|
139 |
|
140 | |
141 |
|
142 |
|
143 |
|
144 | relativeSymlinks?: boolean | ((file: File) => boolean) | undefined;
|
145 |
|
146 |
|
147 | useJunctions?: boolean | ((file: File) => boolean) | undefined;
|
148 | }): NodeJS.ReadWriteStream;
|
149 |
|
\ | No newline at end of file |