@rsbuild/core 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/chokidar/index.d.ts +318 -189
- package/compiled/chokidar/index.js +1069 -4439
- package/compiled/chokidar/license +1 -1
- package/compiled/chokidar/package.json +1 -1
- package/compiled/tinyglobby/index.d.ts +25 -0
- package/compiled/tinyglobby/index.js +2749 -0
- package/compiled/tinyglobby/index1.js +17 -0
- package/compiled/tinyglobby/license +21 -0
- package/compiled/tinyglobby/package.json +1 -0
- package/dist/ignoreCssLoader.cjs +22 -44
- package/dist/index.cjs +3964 -8135
- package/dist/index.cjs.LICENSE.txt +13 -0
- package/dist/index.js +3957 -8098
- package/dist/index.js.LICENSE.txt +13 -0
- package/dist/transformLoader.cjs +26 -44
- package/dist/transformRawLoader.cjs +26 -53
- package/dist-types/cli/init.d.ts +2 -1
- package/dist-types/config.d.ts +2 -2
- package/dist-types/index.d.ts +1 -1
- package/dist-types/internal.d.ts +1 -13
- package/dist-types/plugins/css.d.ts +1 -2
- package/dist-types/provider/helpers.d.ts +12 -0
- package/dist-types/server/restart.d.ts +4 -0
- package/dist-types/server/watchFiles.d.ts +4 -1
- package/dist-types/types/config.d.ts +14 -6
- package/dist-types/types/rsbuild.d.ts +3 -1
- package/package.json +5 -5
|
@@ -1,198 +1,327 @@
|
|
|
1
|
-
|
|
2
|
-
import * as fs from 'fs';
|
|
1
|
+
import { Stats, Dirent } from 'fs';
|
|
3
2
|
import { EventEmitter } from 'events';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
14
|
-
options: WatchOptions;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
|
18
|
-
*/
|
|
19
|
-
constructor(options?: WatchOptions);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
|
23
|
-
* string.
|
|
24
|
-
*/
|
|
25
|
-
add(paths: string | ReadonlyArray<string>): this;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
|
29
|
-
* string.
|
|
30
|
-
*/
|
|
31
|
-
unwatch(paths: string | ReadonlyArray<string>): this;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Returns an object representing all the paths on the file system being watched by this
|
|
35
|
-
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
|
|
36
|
-
* the `cwd` option was used), and the values are arrays of the names of the items contained in
|
|
37
|
-
* each directory.
|
|
38
|
-
*/
|
|
39
|
-
getWatched(): {
|
|
40
|
-
[directory: string]: string[];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Removes all listeners from watched files.
|
|
45
|
-
*/
|
|
46
|
-
close(): Promise<void>;
|
|
47
|
-
|
|
48
|
-
on(event: 'add'|'addDir'|'change', listener: (path: string, stats?: fs.Stats) => void): this;
|
|
49
|
-
|
|
50
|
-
on(event: 'all', listener: (eventName: 'add'|'addDir'|'change'|'unlink'|'unlinkDir', path: string, stats?: fs.Stats) => void): this;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Error occurred
|
|
54
|
-
*/
|
|
55
|
-
on(event: 'error', listener: (error: Error) => void): this;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Exposes the native Node `fs.FSWatcher events`
|
|
59
|
-
*/
|
|
60
|
-
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Fires when the initial scan is complete
|
|
64
|
-
*/
|
|
65
|
-
on(event: 'ready', listener: () => void): this;
|
|
66
|
-
|
|
67
|
-
on(event: 'unlink'|'unlinkDir', listener: (path: string) => void): this;
|
|
68
|
-
|
|
69
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
70
|
-
|
|
71
|
-
ref(): this;
|
|
72
|
-
|
|
73
|
-
unref(): this;
|
|
3
|
+
import { Readable } from 'stream';
|
|
4
|
+
|
|
5
|
+
type Path$1 = string;
|
|
6
|
+
interface EntryInfo {
|
|
7
|
+
path: string;
|
|
8
|
+
fullPath: string;
|
|
9
|
+
stats?: Stats;
|
|
10
|
+
dirent?: Dirent;
|
|
11
|
+
basename: string;
|
|
74
12
|
}
|
|
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
|
-
* the `useFsEvents` default.
|
|
123
|
-
*/
|
|
124
|
-
usePolling?: boolean;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
|
|
128
|
-
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
|
|
129
|
-
* OS X, `usePolling: true` becomes the default.
|
|
130
|
-
*/
|
|
131
|
-
useFsEvents?: boolean;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
|
|
135
|
-
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
|
|
136
|
-
* provided even in cases where it wasn't already available from the underlying watch events.
|
|
137
|
-
*/
|
|
138
|
-
alwaysStat?: boolean;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* If set, limits how many levels of subdirectories will be traversed.
|
|
142
|
-
*/
|
|
143
|
-
depth?: number;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Interval of file system polling.
|
|
147
|
-
*/
|
|
148
|
-
interval?: number;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
|
|
152
|
-
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
|
153
|
-
*/
|
|
154
|
-
binaryInterval?: number;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Indicates whether to watch files that don't have read permissions if possible. If watching
|
|
158
|
-
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
|
|
159
|
-
* silently.
|
|
160
|
-
*/
|
|
161
|
-
ignorePermissionErrors?: boolean;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
|
|
165
|
-
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
166
|
-
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
167
|
-
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
|
168
|
-
* you can override it by setting `atomic` to a custom value, in milliseconds.
|
|
169
|
-
*/
|
|
170
|
-
atomic?: boolean | number;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* can be set to an object in order to adjust timing params:
|
|
174
|
-
*/
|
|
175
|
-
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
|
|
13
|
+
type PathOrDirent = Dirent | Path$1;
|
|
14
|
+
type Tester = (path: EntryInfo) => boolean;
|
|
15
|
+
declare function defaultOptions(): {
|
|
16
|
+
root: string;
|
|
17
|
+
fileFilter: (_path: EntryInfo) => boolean;
|
|
18
|
+
directoryFilter: (_path: EntryInfo) => boolean;
|
|
19
|
+
type: string;
|
|
20
|
+
lstat: boolean;
|
|
21
|
+
depth: number;
|
|
22
|
+
alwaysStat: boolean;
|
|
23
|
+
highWaterMark: number;
|
|
24
|
+
};
|
|
25
|
+
type ReaddirpOptions = ReturnType<typeof defaultOptions>;
|
|
26
|
+
interface DirEntry$1 {
|
|
27
|
+
files: PathOrDirent[];
|
|
28
|
+
depth: number;
|
|
29
|
+
path: Path$1;
|
|
30
|
+
}
|
|
31
|
+
declare class ReaddirpStream extends Readable {
|
|
32
|
+
parents: any[];
|
|
33
|
+
reading: boolean;
|
|
34
|
+
parent?: DirEntry$1;
|
|
35
|
+
_stat: Function;
|
|
36
|
+
_maxDepth: number;
|
|
37
|
+
_wantsDir: boolean;
|
|
38
|
+
_wantsFile: boolean;
|
|
39
|
+
_wantsEverything: boolean;
|
|
40
|
+
_root: Path$1;
|
|
41
|
+
_isDirent: boolean;
|
|
42
|
+
_statsProp: 'dirent' | 'stats';
|
|
43
|
+
_rdOptions: {
|
|
44
|
+
encoding: 'utf8';
|
|
45
|
+
withFileTypes: boolean;
|
|
46
|
+
};
|
|
47
|
+
_fileFilter: Tester;
|
|
48
|
+
_directoryFilter: Tester;
|
|
49
|
+
constructor(options?: Partial<ReaddirpOptions>);
|
|
50
|
+
_read(batch: number): Promise<void>;
|
|
51
|
+
_exploreDir(path: Path$1, depth: number): Promise<{
|
|
52
|
+
files: string[] | undefined;
|
|
53
|
+
depth: number;
|
|
54
|
+
path: string;
|
|
55
|
+
}>;
|
|
56
|
+
_formatEntry(dirent: PathOrDirent, path: Path$1): Promise<EntryInfo | undefined>;
|
|
57
|
+
_onError(err: Error): void;
|
|
58
|
+
_getEntryType(entry: EntryInfo): Promise<void | "" | "file" | "directory">;
|
|
59
|
+
_includeAsFile(entry: EntryInfo): boolean | undefined;
|
|
176
60
|
}
|
|
177
61
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
62
|
+
type Path = string;
|
|
63
|
+
declare const EVENTS: {
|
|
64
|
+
readonly ALL: "all";
|
|
65
|
+
readonly READY: "ready";
|
|
66
|
+
readonly ADD: "add";
|
|
67
|
+
readonly CHANGE: "change";
|
|
68
|
+
readonly ADD_DIR: "addDir";
|
|
69
|
+
readonly UNLINK: "unlink";
|
|
70
|
+
readonly UNLINK_DIR: "unlinkDir";
|
|
71
|
+
readonly RAW: "raw";
|
|
72
|
+
readonly ERROR: "error";
|
|
73
|
+
};
|
|
74
|
+
type EventName = (typeof EVENTS)[keyof typeof EVENTS];
|
|
75
|
+
/**
|
|
76
|
+
* @mixin
|
|
77
|
+
*/
|
|
78
|
+
declare class NodeFsHandler {
|
|
79
|
+
fsw: FSWatcher;
|
|
80
|
+
_boundHandleError: (error: unknown) => void;
|
|
81
|
+
constructor(fsW: FSWatcher);
|
|
82
|
+
/**
|
|
83
|
+
* Watch file for changes with fs_watchFile or fs_watch.
|
|
84
|
+
* @param path to file or dir
|
|
85
|
+
* @param listener on fs change
|
|
86
|
+
* @returns closer for the watcher instance
|
|
87
|
+
*/
|
|
88
|
+
_watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Watch a file and emit add event if warranted.
|
|
91
|
+
* @returns closer for the watcher instance
|
|
92
|
+
*/
|
|
93
|
+
_handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Handle symlinks encountered while reading a dir.
|
|
96
|
+
* @param entry returned by readdirp
|
|
97
|
+
* @param directory path of dir being read
|
|
98
|
+
* @param path of this item
|
|
99
|
+
* @param item basename of this item
|
|
100
|
+
* @returns true if no more processing is needed for this entry.
|
|
101
|
+
*/
|
|
102
|
+
_handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
|
|
103
|
+
_handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
|
106
|
+
* @param dir fs path
|
|
107
|
+
* @param stats
|
|
108
|
+
* @param initialAdd
|
|
109
|
+
* @param depth relative to user-supplied path
|
|
110
|
+
* @param target child path targeted for watch
|
|
111
|
+
* @param wh Common watch helpers for this path
|
|
112
|
+
* @param realpath
|
|
113
|
+
* @returns closer for the watcher instance.
|
|
114
|
+
*/
|
|
115
|
+
_handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
|
|
116
|
+
/**
|
|
117
|
+
* Handle added file, directory, or glob pattern.
|
|
118
|
+
* Delegates call to _handleFile / _handleDir after checks.
|
|
119
|
+
* @param path to file or ir
|
|
120
|
+
* @param initialAdd was the file added at watch instantiation?
|
|
121
|
+
* @param priorWh depth relative to user-supplied path
|
|
122
|
+
* @param depth Child path actually targeted for watch
|
|
123
|
+
* @param target Child path actually targeted for watch
|
|
124
|
+
*/
|
|
125
|
+
_addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
|
|
188
126
|
}
|
|
189
127
|
|
|
128
|
+
type AWF = {
|
|
129
|
+
stabilityThreshold: number;
|
|
130
|
+
pollInterval: number;
|
|
131
|
+
};
|
|
132
|
+
type BasicOpts = {
|
|
133
|
+
persistent: boolean;
|
|
134
|
+
ignoreInitial: boolean;
|
|
135
|
+
followSymlinks: boolean;
|
|
136
|
+
cwd?: string;
|
|
137
|
+
usePolling: boolean;
|
|
138
|
+
interval: number;
|
|
139
|
+
binaryInterval: number;
|
|
140
|
+
alwaysStat?: boolean;
|
|
141
|
+
depth?: number;
|
|
142
|
+
ignorePermissionErrors: boolean;
|
|
143
|
+
atomic: boolean | number;
|
|
144
|
+
};
|
|
145
|
+
type Throttler = {
|
|
146
|
+
timeoutObject: NodeJS.Timeout;
|
|
147
|
+
clear: () => void;
|
|
148
|
+
count: number;
|
|
149
|
+
};
|
|
150
|
+
type ChokidarOptions = Partial<BasicOpts & {
|
|
151
|
+
ignored: Matcher | Matcher[];
|
|
152
|
+
awaitWriteFinish: boolean | Partial<AWF>;
|
|
153
|
+
}>;
|
|
154
|
+
type FSWInstanceOptions = BasicOpts & {
|
|
155
|
+
ignored: Matcher[];
|
|
156
|
+
awaitWriteFinish: false | AWF;
|
|
157
|
+
};
|
|
158
|
+
type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
|
|
159
|
+
type EmitArgs = [EventName, Path | Error, any?, any?, any?];
|
|
160
|
+
type MatchFunction = (val: string, stats?: Stats) => boolean;
|
|
161
|
+
interface MatcherObject {
|
|
162
|
+
path: string;
|
|
163
|
+
recursive?: boolean;
|
|
164
|
+
}
|
|
165
|
+
type Matcher = string | RegExp | MatchFunction | MatcherObject;
|
|
166
|
+
/**
|
|
167
|
+
* Directory entry.
|
|
168
|
+
*/
|
|
169
|
+
declare class DirEntry {
|
|
170
|
+
path: Path;
|
|
171
|
+
_removeWatcher: (dir: string, base: string) => void;
|
|
172
|
+
items: Set<Path>;
|
|
173
|
+
constructor(dir: Path, removeWatcher: (dir: string, base: string) => void);
|
|
174
|
+
add(item: string): void;
|
|
175
|
+
remove(item: string): Promise<void>;
|
|
176
|
+
has(item: string): boolean | undefined;
|
|
177
|
+
getChildren(): string[];
|
|
178
|
+
dispose(): void;
|
|
179
|
+
}
|
|
180
|
+
declare class WatchHelper {
|
|
181
|
+
fsw: FSWatcher;
|
|
182
|
+
path: string;
|
|
183
|
+
watchPath: string;
|
|
184
|
+
fullWatchPath: string;
|
|
185
|
+
dirParts: string[][];
|
|
186
|
+
followSymlinks: boolean;
|
|
187
|
+
statMethod: 'stat' | 'lstat';
|
|
188
|
+
constructor(path: string, follow: boolean, fsw: FSWatcher);
|
|
189
|
+
entryPath(entry: EntryInfo): Path;
|
|
190
|
+
filterPath(entry: EntryInfo): boolean;
|
|
191
|
+
filterDir(entry: EntryInfo): boolean;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Watches files & directories for changes. Emitted events:
|
|
195
|
+
* `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
|
|
196
|
+
*
|
|
197
|
+
* new FSWatcher()
|
|
198
|
+
* .add(directories)
|
|
199
|
+
* .on('add', path => log('File', path, 'was added'))
|
|
200
|
+
*/
|
|
201
|
+
declare class FSWatcher extends EventEmitter {
|
|
202
|
+
closed: boolean;
|
|
203
|
+
options: FSWInstanceOptions;
|
|
204
|
+
_closers: Map<string, Array<any>>;
|
|
205
|
+
_ignoredPaths: Set<Matcher>;
|
|
206
|
+
_throttled: Map<ThrottleType, Map<any, any>>;
|
|
207
|
+
_streams: Set<ReaddirpStream>;
|
|
208
|
+
_symlinkPaths: Map<Path, string | boolean>;
|
|
209
|
+
_watched: Map<string, DirEntry>;
|
|
210
|
+
_pendingWrites: Map<string, any>;
|
|
211
|
+
_pendingUnlinks: Map<string, EmitArgs>;
|
|
212
|
+
_readyCount: number;
|
|
213
|
+
_emitReady: () => void;
|
|
214
|
+
_closePromise?: Promise<void>;
|
|
215
|
+
_userIgnored?: MatchFunction;
|
|
216
|
+
_readyEmitted: boolean;
|
|
217
|
+
_emitRaw: () => void;
|
|
218
|
+
_boundRemove: (dir: string, item: string) => void;
|
|
219
|
+
_nodeFsHandler: NodeFsHandler;
|
|
220
|
+
constructor(_opts?: ChokidarOptions);
|
|
221
|
+
_addIgnoredPath(matcher: Matcher): void;
|
|
222
|
+
_removeIgnoredPath(matcher: Matcher): void;
|
|
223
|
+
/**
|
|
224
|
+
* Adds paths to be watched on an existing FSWatcher instance.
|
|
225
|
+
* @param paths_ file or file list. Other arguments are unused
|
|
226
|
+
*/
|
|
227
|
+
add(paths_: Path | Path[], _origAdd?: string, _internal?: boolean): FSWatcher;
|
|
228
|
+
/**
|
|
229
|
+
* Close watchers or start ignoring events from specified paths.
|
|
230
|
+
*/
|
|
231
|
+
unwatch(paths_: Path | Path[]): FSWatcher;
|
|
232
|
+
/**
|
|
233
|
+
* Close watchers and remove all listeners from watched paths.
|
|
234
|
+
*/
|
|
235
|
+
close(): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Expose list of watched paths
|
|
238
|
+
* @returns for chaining
|
|
239
|
+
*/
|
|
240
|
+
getWatched(): Record<string, string[]>;
|
|
241
|
+
emitWithAll(event: EventName, args: EmitArgs): void;
|
|
242
|
+
/**
|
|
243
|
+
* Normalize and emit events.
|
|
244
|
+
* Calling _emit DOES NOT MEAN emit() would be called!
|
|
245
|
+
* @param event Type of event
|
|
246
|
+
* @param path File or directory path
|
|
247
|
+
* @param stats arguments to be passed with event
|
|
248
|
+
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
249
|
+
*/
|
|
250
|
+
_emit(event: EventName, path: Path, stats?: Stats): Promise<this | undefined>;
|
|
251
|
+
/**
|
|
252
|
+
* Common handler for errors
|
|
253
|
+
* @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
254
|
+
*/
|
|
255
|
+
_handleError(error: Error): Error | boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Helper utility for throttling
|
|
258
|
+
* @param actionType type being throttled
|
|
259
|
+
* @param path being acted upon
|
|
260
|
+
* @param timeout duration of time to suppress duplicate actions
|
|
261
|
+
* @returns tracking object or false if action should be suppressed
|
|
262
|
+
*/
|
|
263
|
+
_throttle(actionType: ThrottleType, path: Path, timeout: number): Throttler | false;
|
|
264
|
+
_incrReadyCount(): number;
|
|
265
|
+
/**
|
|
266
|
+
* Awaits write operation to finish.
|
|
267
|
+
* Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
|
|
268
|
+
* @param path being acted upon
|
|
269
|
+
* @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
|
|
270
|
+
* @param event
|
|
271
|
+
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
272
|
+
*/
|
|
273
|
+
_awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats) => void): void;
|
|
274
|
+
/**
|
|
275
|
+
* Determines whether user has asked to ignore this path.
|
|
276
|
+
*/
|
|
277
|
+
_isIgnored(path: Path, stats?: Stats): boolean;
|
|
278
|
+
_isntIgnored(path: Path, stat?: Stats): boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Provides a set of common helpers and properties relating to symlink handling.
|
|
281
|
+
* @param path file or directory pattern being watched
|
|
282
|
+
*/
|
|
283
|
+
_getWatchHelpers(path: Path): WatchHelper;
|
|
284
|
+
/**
|
|
285
|
+
* Provides directory tracking objects
|
|
286
|
+
* @param directory path of the directory
|
|
287
|
+
*/
|
|
288
|
+
_getWatchedDir(directory: string): DirEntry;
|
|
289
|
+
/**
|
|
290
|
+
* Check for read permissions: https://stackoverflow.com/a/11781404/1358405
|
|
291
|
+
*/
|
|
292
|
+
_hasReadPermissions(stats: Stats): boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Handles emitting unlink events for
|
|
295
|
+
* files and directories, and via recursion, for
|
|
296
|
+
* files and directories within directories that are unlinked
|
|
297
|
+
* @param directory within which the following item is located
|
|
298
|
+
* @param item base path of item/directory
|
|
299
|
+
*/
|
|
300
|
+
_remove(directory: string, item: string, isDirectory?: boolean): void;
|
|
301
|
+
/**
|
|
302
|
+
* Closes all watchers for a path
|
|
303
|
+
*/
|
|
304
|
+
_closePath(path: Path): void;
|
|
305
|
+
/**
|
|
306
|
+
* Closes only file-specific watchers
|
|
307
|
+
*/
|
|
308
|
+
_closeFile(path: Path): void;
|
|
309
|
+
_addPathCloser(path: Path, closer: () => void): void;
|
|
310
|
+
_readdirp(root: Path, opts?: Partial<ReaddirpOptions>): ReaddirpStream | undefined;
|
|
311
|
+
}
|
|
190
312
|
/**
|
|
191
|
-
*
|
|
313
|
+
* Instantiates watcher with paths to be tracked.
|
|
314
|
+
* @param paths file / directory paths
|
|
315
|
+
* @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
|
|
316
|
+
* @returns an instance of FSWatcher for chaining.
|
|
317
|
+
* @example
|
|
318
|
+
* const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
|
|
319
|
+
* watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
|
|
192
320
|
*/
|
|
193
|
-
declare function watch(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
321
|
+
declare function watch(paths: string | string[], options?: ChokidarOptions): FSWatcher;
|
|
322
|
+
declare const _default: {
|
|
323
|
+
watch: typeof watch;
|
|
324
|
+
FSWatcher: typeof FSWatcher;
|
|
325
|
+
};
|
|
197
326
|
|
|
198
|
-
export { type
|
|
327
|
+
export { type ChokidarOptions, type EmitArgs, type FSWInstanceOptions, FSWatcher, type MatchFunction, type Matcher, type MatcherObject, type ThrottleType, type Throttler, WatchHelper, _default as default, watch };
|