-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Expand file tree
/
Copy pathindex.d.ts
More file actions
219 lines (187 loc) · 7.87 KB
/
index.d.ts
File metadata and controls
219 lines (187 loc) · 7.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// Type definitions for vinyl-fs 2.4
// Project: https://github.com/gulpjs/vinyl-fs
// Definitions by: vvakame <https://github.com/vvakame>
// remisery <https://github.com/remisery>
// TeamworkGuy2 <https://github.com/TeamworkGuy2>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare global {
namespace NodeJS {
interface WritableStream {
write(buffer: any/* Vinyl.File */, cb?: (err?: Error | null) => void): boolean;
}
}
}
import * as _events from 'events';
import * as File from 'vinyl';
import * as globStream from 'glob-stream';
export interface SrcOptions extends globStream.Options {
/** Prevents stream from emitting an error when file not found. */
allowEmpty?: boolean | undefined;
/** Specifies the working directory the folder is relative to */
cwd?: string | undefined;
/**
* Specifies the folder relative to the cwd
* This is used to determine the file names when saving in .dest()
* Default: where the glob begins
*/
base?: string | undefined;
/**
* Setting this to false will make file.contents a paused stream
* If true it will buffer the file contents
* Default: true
*/
buffer?: boolean | undefined;
/**
* The mode the directory should be created with.
* Default: the process mode
*/
dirMode?: number | undefined;
/**
* Whether or not you want globs to match on dot files or not
* (e.g., `.gitignore`).
*/
dot?: boolean | undefined;
/**
* Whether or not to recursively resolve symlinks to their targets.
* Setting to `false` to preserve them as symlinks and make `file.symlink`
* equal the original symlink's target path.
* Default: true
*/
followSymlinks?: boolean | undefined;
/**
* Setting this to false will ignore the contents of the file and disable
* writing to disk to speed up operations
* Default: true
*/
read?: boolean | undefined;
/**
* Whether or not the symlink should be relative or absolute.
* Default: false
*/
relative?: boolean | undefined;
/** Only find files that have been modified since the time specified */
since?: Date | number | undefined;
/**
* Causes the BOM to be stripped on UTF-8 encoded files. Set to `false`
* if you need the BOM for some reason.
*/
stripBOM?: boolean | undefined;
/**
* Setting this to true will create a duplex stream, one that passes
* through items and emits globbed files.
* Default: false
*/
passthrough?: boolean | undefined;
/**
* Setting this to true will enable sourcemaps.
* Default: false
*/
sourcemaps?: boolean | undefined;
/**
* Whether or not to recursively resolve symlinks to their targets. Setting to false to
* preserve them as symlinks and make file.symlink equal the original symlink's target path.
* Default: false
*/
resolveSymlinks?: boolean | undefined;
/**
* Causes the BOM to be removed on UTF-8 encoded files. Set to false if you need the BOM for some reason.
* Default: true
*/
removeBOM?: boolean | undefined;
}
export interface DestOptions {
/**
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
cwd?: string | undefined;
/**
* Specify the mode the files should be created with
* Default is the mode of the input file (file.stat.mode)
* or the process mode if the input file has no mode property
*/
mode?: number | string | undefined;
/** Specify the mode the directory should be created with. Default is the process mode */
dirMode?: number | string | undefined;
/** Specify if existing files with the same path should be overwritten or not. Default is true, to always overwrite existing files */
overwrite?: boolean | undefined;
/**
* Enables sourcemap support on files passed through the stream. Will write inline soucemaps if
* specified as true. Specifying a string path will write external sourcemaps at the given path.
*/
sourcemaps?: true | string | undefined;
/**
* When creating a symlink, whether or not the created symlink should be relative. If false,
* the symlink will be absolute. Note: This option will be ignored if a junction is being created.
*/
relativeSymlinks?: boolean | undefined;
/* When creating a symlink, whether or not a directory symlink should be created as a junction. */
useJunctions?: boolean | undefined;
}
/**
* Gets files that match the glob and converts them into the vinyl format
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
* @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream
*/
export function src(globs: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream;
/**
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
* After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
* stat.mode will be overwritten if you used a mode parameter
* contents will have it's position reset to the beginning if it is a stream
* @param folder destination folder
*/
export function dest(folder: string, opt?: DestOptions): NodeJS.ReadWriteStream;
/**
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
* After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
* stat.mode will be overwritten if you used a mode parameter
* contents will have it's position reset to the beginning if it is a stream
* @param getFolderPath function that takes in a file and returns a folder path
*/
export function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStream;
/**
* On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified.
* After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
*/
export function symlink(folder: string, opts?: {
/**
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
cwd?: string | undefined;
/** Specify the mode the directory should be created with. Default is the process mode */
mode?: number | string | undefined;
/**
* Specify the mode the directory should be created with
* Default is the process mode
*/
dirMode?: number | undefined
}): NodeJS.ReadWriteStream;
/**
* On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd generated from getFolderPath.
* After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
*/
export function symlink(getFolderPath: (File: File) => string, opts?: {
/**
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
cwd?: string | undefined;
/**
* Specify the mode the directory should be created with
* Default is the process mode
*/
dirMode?: number | undefined
}): NodeJS.ReadWriteStream;