@rspack/core 2.0.0 → 2.0.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/http-proxy-middleware/index.d.ts +229 -391
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/watchpack/index.d.ts +2 -218
- package/compiled/watchpack/index.js +1387 -939
- package/compiled/watchpack/package.json +8 -1
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +333 -0
- package/compiled/watchpack/types/LinkResolver.d.ts +10 -0
- package/compiled/watchpack/types/getWatcherManager.d.ts +62 -0
- package/compiled/watchpack/types/index.d.ts +261 -0
- package/compiled/watchpack/types/reducePlan.d.ts +34 -0
- package/compiled/watchpack/types/watchEventSource.d.ts +53 -0
- package/compiled/watchpack/types/watchpack.d.ts +2 -0
- package/dist/Compilation.d.ts +2 -2
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/rsc/index.d.ts +4 -4
- package/dist/index.js +34 -25
- package/dist/stats/statsFactoryUtils.d.ts +3 -3
- package/package.json +7 -8
|
@@ -1 +1,8 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "watchpack",
|
|
3
|
+
"author": "Tobias Koppers @sokra",
|
|
4
|
+
"version": "2.5.1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"type": "commonjs"
|
|
8
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
export = DirectoryWatcher;
|
|
2
|
+
/** @typedef {Set<string>} InitialScanRemoved */
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {object} WatchpackEvents
|
|
5
|
+
* @property {(target: string, mtime: string, type: EventType, initial: boolean) => void} change change event
|
|
6
|
+
* @property {() => void} closed closed event
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} DirectoryWatcherOptions
|
|
10
|
+
* @property {boolean=} followSymlinks true when need to resolve symlinks and watch symlink and real file, otherwise false
|
|
11
|
+
* @property {IgnoredFunction=} ignored ignore some files from watching (glob pattern or regexp)
|
|
12
|
+
* @property {number | boolean=} poll true when need to enable polling mode for watching, otherwise false
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @extends {EventEmitter<{ [K in keyof WatchpackEvents]: Parameters<WatchpackEvents[K]> }>}
|
|
16
|
+
*/
|
|
17
|
+
declare class DirectoryWatcher extends EventEmitter<{
|
|
18
|
+
/**
|
|
19
|
+
* change event
|
|
20
|
+
*/
|
|
21
|
+
change: [
|
|
22
|
+
target: string,
|
|
23
|
+
mtime: string,
|
|
24
|
+
type: import("./index").EventType,
|
|
25
|
+
initial: boolean,
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* closed event
|
|
29
|
+
*/
|
|
30
|
+
closed: [];
|
|
31
|
+
}> {
|
|
32
|
+
/**
|
|
33
|
+
* @param {WatcherManager} watcherManager a watcher manager
|
|
34
|
+
* @param {string} directoryPath directory path
|
|
35
|
+
* @param {DirectoryWatcherOptions=} options options
|
|
36
|
+
*/
|
|
37
|
+
constructor(
|
|
38
|
+
watcherManager: WatcherManager,
|
|
39
|
+
directoryPath: string,
|
|
40
|
+
options?: DirectoryWatcherOptions | undefined,
|
|
41
|
+
);
|
|
42
|
+
watcherManager: import("./getWatcherManager").WatcherManager;
|
|
43
|
+
options: DirectoryWatcherOptions;
|
|
44
|
+
path: string;
|
|
45
|
+
/** @type {Map<string, Entry>} */
|
|
46
|
+
files: Map<string, Entry>;
|
|
47
|
+
/** @type {Map<string, number>} */
|
|
48
|
+
filesWithoutCase: Map<string, number>;
|
|
49
|
+
/** @type {Map<string, Watcher<DirectoryWatcherEvents> | boolean>} */
|
|
50
|
+
directories: Map<string, Watcher<DirectoryWatcherEvents> | boolean>;
|
|
51
|
+
lastWatchEvent: number;
|
|
52
|
+
initialScan: boolean;
|
|
53
|
+
ignored: import("./index").IgnoredFunction;
|
|
54
|
+
nestedWatching: boolean;
|
|
55
|
+
/** @type {number | false} */
|
|
56
|
+
polledWatching: number | false;
|
|
57
|
+
/** @type {undefined | NodeJS.Timeout} */
|
|
58
|
+
timeout: undefined | NodeJS.Timeout;
|
|
59
|
+
/** @type {null | InitialScanRemoved} */
|
|
60
|
+
initialScanRemoved: null | InitialScanRemoved;
|
|
61
|
+
/** @type {undefined | number} */
|
|
62
|
+
initialScanFinished: undefined | number;
|
|
63
|
+
/** @type {Map<string, Set<Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>>>} */
|
|
64
|
+
watchers: Map<
|
|
65
|
+
string,
|
|
66
|
+
Set<Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>>
|
|
67
|
+
>;
|
|
68
|
+
/** @type {Watcher<FileWatcherEvents> | null} */
|
|
69
|
+
parentWatcher: Watcher<FileWatcherEvents> | null;
|
|
70
|
+
refs: number;
|
|
71
|
+
/** @type {Map<string, boolean>} */
|
|
72
|
+
_activeEvents: Map<string, boolean>;
|
|
73
|
+
closed: boolean;
|
|
74
|
+
scanning: boolean;
|
|
75
|
+
scanAgain: boolean;
|
|
76
|
+
scanAgainInitial: boolean;
|
|
77
|
+
createWatcher(): void;
|
|
78
|
+
watcher: watchEventSource.Watcher | null | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* @template {(watcher: Watcher<EventMap>) => void} T
|
|
81
|
+
* @param {string} path path
|
|
82
|
+
* @param {T} fn function
|
|
83
|
+
*/
|
|
84
|
+
forEachWatcher<T extends (watcher: Watcher<EventMap>) => void>(
|
|
85
|
+
path: string,
|
|
86
|
+
fn: T,
|
|
87
|
+
): void;
|
|
88
|
+
/**
|
|
89
|
+
* @param {string} itemPath an item path
|
|
90
|
+
* @param {boolean} initial true when initial, otherwise false
|
|
91
|
+
* @param {EventType} type even type
|
|
92
|
+
*/
|
|
93
|
+
setMissing(itemPath: string, initial: boolean, type: EventType): void;
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} target a target to set file time
|
|
96
|
+
* @param {number} mtime mtime
|
|
97
|
+
* @param {boolean} initial true when initial, otherwise false
|
|
98
|
+
* @param {boolean} ignoreWhenEqual true to ignore when equal, otherwise false
|
|
99
|
+
* @param {EventType} type type
|
|
100
|
+
*/
|
|
101
|
+
setFileTime(
|
|
102
|
+
target: string,
|
|
103
|
+
mtime: number,
|
|
104
|
+
initial: boolean,
|
|
105
|
+
ignoreWhenEqual: boolean,
|
|
106
|
+
type: EventType,
|
|
107
|
+
): void;
|
|
108
|
+
/**
|
|
109
|
+
* @param {string} directoryPath directory path
|
|
110
|
+
* @param {number} birthtime birthtime
|
|
111
|
+
* @param {boolean} initial true when initial, otherwise false
|
|
112
|
+
* @param {EventType} type even type
|
|
113
|
+
*/
|
|
114
|
+
setDirectory(
|
|
115
|
+
directoryPath: string,
|
|
116
|
+
birthtime: number,
|
|
117
|
+
initial: boolean,
|
|
118
|
+
type: EventType,
|
|
119
|
+
): void;
|
|
120
|
+
/**
|
|
121
|
+
* @param {string} directoryPath directory path
|
|
122
|
+
*/
|
|
123
|
+
createNestedWatcher(directoryPath: string): void;
|
|
124
|
+
/**
|
|
125
|
+
* @param {boolean} flag true when nested, otherwise false
|
|
126
|
+
*/
|
|
127
|
+
setNestedWatching(flag: boolean): void;
|
|
128
|
+
/**
|
|
129
|
+
* @param {string} target a target to watch
|
|
130
|
+
* @param {number=} startTime start time
|
|
131
|
+
* @returns {Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>} watcher
|
|
132
|
+
*/
|
|
133
|
+
watch(
|
|
134
|
+
target: string,
|
|
135
|
+
startTime?: number | undefined,
|
|
136
|
+
): Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>;
|
|
137
|
+
/**
|
|
138
|
+
* @param {EventType} eventType event type
|
|
139
|
+
* @param {string=} filename filename
|
|
140
|
+
*/
|
|
141
|
+
onWatchEvent(eventType: EventType, filename?: string | undefined): void;
|
|
142
|
+
/**
|
|
143
|
+
* @param {unknown=} err error
|
|
144
|
+
*/
|
|
145
|
+
onWatcherError(err?: unknown | undefined): void;
|
|
146
|
+
/**
|
|
147
|
+
* @param {Error | NodeJS.ErrnoException=} err error
|
|
148
|
+
*/
|
|
149
|
+
onStatsError(err?: (Error | NodeJS.ErrnoException) | undefined): void;
|
|
150
|
+
/**
|
|
151
|
+
* @param {Error | NodeJS.ErrnoException=} err error
|
|
152
|
+
*/
|
|
153
|
+
onScanError(err?: (Error | NodeJS.ErrnoException) | undefined): void;
|
|
154
|
+
onScanFinished(): void;
|
|
155
|
+
/**
|
|
156
|
+
* @param {string} reason a reason
|
|
157
|
+
*/
|
|
158
|
+
onDirectoryRemoved(reason: string): void;
|
|
159
|
+
watchInParentDirectory(): void;
|
|
160
|
+
/**
|
|
161
|
+
* @param {boolean} initial true when initial, otherwise false
|
|
162
|
+
*/
|
|
163
|
+
doScan(initial: boolean): void;
|
|
164
|
+
/**
|
|
165
|
+
* @returns {Record<string, number>} times
|
|
166
|
+
*/
|
|
167
|
+
getTimes(): Record<string, number>;
|
|
168
|
+
/**
|
|
169
|
+
* @param {TimeInfoEntries} fileTimestamps file timestamps
|
|
170
|
+
* @param {TimeInfoEntries} directoryTimestamps directory timestamps
|
|
171
|
+
* @returns {number} safe time
|
|
172
|
+
*/
|
|
173
|
+
collectTimeInfoEntries(
|
|
174
|
+
fileTimestamps: TimeInfoEntries,
|
|
175
|
+
directoryTimestamps: TimeInfoEntries,
|
|
176
|
+
): number;
|
|
177
|
+
close(): void;
|
|
178
|
+
}
|
|
179
|
+
declare namespace DirectoryWatcher {
|
|
180
|
+
export {
|
|
181
|
+
EXISTANCE_ONLY_TIME_ENTRY,
|
|
182
|
+
Watcher,
|
|
183
|
+
IgnoredFunction,
|
|
184
|
+
EventType,
|
|
185
|
+
TimeInfoEntries,
|
|
186
|
+
Entry,
|
|
187
|
+
ExistenceOnlyTimeEntry,
|
|
188
|
+
OnlySafeTimeEntry,
|
|
189
|
+
EventMap,
|
|
190
|
+
WatcherManager,
|
|
191
|
+
EventSourceWatcher,
|
|
192
|
+
FileWatcherEvents,
|
|
193
|
+
DirectoryWatcherEvents,
|
|
194
|
+
InitialScanRemoved,
|
|
195
|
+
WatchpackEvents,
|
|
196
|
+
DirectoryWatcherOptions,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
import { EventEmitter } from "events";
|
|
200
|
+
/**
|
|
201
|
+
* @typedef {object} FileWatcherEvents
|
|
202
|
+
* @property {(type: EventType) => void} initial-missing initial missing event
|
|
203
|
+
* @property {(mtime: number, type: EventType, initial: boolean) => void} change change event
|
|
204
|
+
* @property {(type: EventType) => void} remove remove event
|
|
205
|
+
* @property {() => void} closed closed event
|
|
206
|
+
*/
|
|
207
|
+
/**
|
|
208
|
+
* @typedef {object} DirectoryWatcherEvents
|
|
209
|
+
* @property {(type: EventType) => void} initial-missing initial missing event
|
|
210
|
+
* @property {((file: string, mtime: number, type: EventType, initial: boolean) => void)} change change event
|
|
211
|
+
* @property {(type: EventType) => void} remove remove event
|
|
212
|
+
* @property {() => void} closed closed event
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* @template {EventMap} T
|
|
216
|
+
* @extends {EventEmitter<{ [K in keyof T]: Parameters<T[K]> }>}
|
|
217
|
+
*/
|
|
218
|
+
declare class Watcher<T extends EventMap> extends EventEmitter<{
|
|
219
|
+
[K in keyof T]: Parameters<T[K]>;
|
|
220
|
+
}> {
|
|
221
|
+
/**
|
|
222
|
+
* @param {DirectoryWatcher} directoryWatcher a directory watcher
|
|
223
|
+
* @param {string} target a target to watch
|
|
224
|
+
* @param {number=} startTime start time
|
|
225
|
+
*/
|
|
226
|
+
constructor(
|
|
227
|
+
directoryWatcher: DirectoryWatcher,
|
|
228
|
+
target: string,
|
|
229
|
+
startTime?: number | undefined,
|
|
230
|
+
);
|
|
231
|
+
directoryWatcher: DirectoryWatcher;
|
|
232
|
+
path: string;
|
|
233
|
+
startTime: number | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* @param {number} mtime mtime
|
|
236
|
+
* @param {boolean} initial true when initial, otherwise false
|
|
237
|
+
* @returns {boolean} true of start time less than mtile, otherwise false
|
|
238
|
+
*/
|
|
239
|
+
checkStartTime(mtime: number, initial: boolean): boolean;
|
|
240
|
+
close(): void;
|
|
241
|
+
}
|
|
242
|
+
import watchEventSource = require("./watchEventSource");
|
|
243
|
+
/** @typedef {import("./index").IgnoredFunction} IgnoredFunction */
|
|
244
|
+
/** @typedef {import("./index").EventType} EventType */
|
|
245
|
+
/** @typedef {import("./index").TimeInfoEntries} TimeInfoEntries */
|
|
246
|
+
/** @typedef {import("./index").Entry} Entry */
|
|
247
|
+
/** @typedef {import("./index").ExistenceOnlyTimeEntry} ExistenceOnlyTimeEntry */
|
|
248
|
+
/** @typedef {import("./index").OnlySafeTimeEntry} OnlySafeTimeEntry */
|
|
249
|
+
/** @typedef {import("./index").EventMap} EventMap */
|
|
250
|
+
/** @typedef {import("./getWatcherManager").WatcherManager} WatcherManager */
|
|
251
|
+
/** @typedef {import("./watchEventSource").Watcher} EventSourceWatcher */
|
|
252
|
+
/** @type {ExistenceOnlyTimeEntry} */
|
|
253
|
+
declare const EXISTANCE_ONLY_TIME_ENTRY: ExistenceOnlyTimeEntry;
|
|
254
|
+
type IgnoredFunction = import("./index").IgnoredFunction;
|
|
255
|
+
type EventType = import("./index").EventType;
|
|
256
|
+
type TimeInfoEntries = import("./index").TimeInfoEntries;
|
|
257
|
+
type Entry = import("./index").Entry;
|
|
258
|
+
type ExistenceOnlyTimeEntry = import("./index").ExistenceOnlyTimeEntry;
|
|
259
|
+
type OnlySafeTimeEntry = import("./index").OnlySafeTimeEntry;
|
|
260
|
+
type EventMap = import("./index").EventMap;
|
|
261
|
+
type WatcherManager = import("./getWatcherManager").WatcherManager;
|
|
262
|
+
type EventSourceWatcher = import("./watchEventSource").Watcher;
|
|
263
|
+
type FileWatcherEvents = {
|
|
264
|
+
/**
|
|
265
|
+
* initial missing event
|
|
266
|
+
*/
|
|
267
|
+
"initial-missing": (type: EventType) => void;
|
|
268
|
+
/**
|
|
269
|
+
* change event
|
|
270
|
+
*/
|
|
271
|
+
change: (mtime: number, type: EventType, initial: boolean) => void;
|
|
272
|
+
/**
|
|
273
|
+
* remove event
|
|
274
|
+
*/
|
|
275
|
+
remove: (type: EventType) => void;
|
|
276
|
+
/**
|
|
277
|
+
* closed event
|
|
278
|
+
*/
|
|
279
|
+
closed: () => void;
|
|
280
|
+
};
|
|
281
|
+
type DirectoryWatcherEvents = {
|
|
282
|
+
/**
|
|
283
|
+
* initial missing event
|
|
284
|
+
*/
|
|
285
|
+
"initial-missing": (type: EventType) => void;
|
|
286
|
+
/**
|
|
287
|
+
* change event
|
|
288
|
+
*/
|
|
289
|
+
change: (
|
|
290
|
+
file: string,
|
|
291
|
+
mtime: number,
|
|
292
|
+
type: EventType,
|
|
293
|
+
initial: boolean,
|
|
294
|
+
) => void;
|
|
295
|
+
/**
|
|
296
|
+
* remove event
|
|
297
|
+
*/
|
|
298
|
+
remove: (type: EventType) => void;
|
|
299
|
+
/**
|
|
300
|
+
* closed event
|
|
301
|
+
*/
|
|
302
|
+
closed: () => void;
|
|
303
|
+
};
|
|
304
|
+
type InitialScanRemoved = Set<string>;
|
|
305
|
+
type WatchpackEvents = {
|
|
306
|
+
/**
|
|
307
|
+
* change event
|
|
308
|
+
*/
|
|
309
|
+
change: (
|
|
310
|
+
target: string,
|
|
311
|
+
mtime: string,
|
|
312
|
+
type: EventType,
|
|
313
|
+
initial: boolean,
|
|
314
|
+
) => void;
|
|
315
|
+
/**
|
|
316
|
+
* closed event
|
|
317
|
+
*/
|
|
318
|
+
closed: () => void;
|
|
319
|
+
};
|
|
320
|
+
type DirectoryWatcherOptions = {
|
|
321
|
+
/**
|
|
322
|
+
* true when need to resolve symlinks and watch symlink and real file, otherwise false
|
|
323
|
+
*/
|
|
324
|
+
followSymlinks?: boolean | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* ignore some files from watching (glob pattern or regexp)
|
|
327
|
+
*/
|
|
328
|
+
ignored?: IgnoredFunction | undefined;
|
|
329
|
+
/**
|
|
330
|
+
* true when need to enable polling mode for watching, otherwise false
|
|
331
|
+
*/
|
|
332
|
+
poll?: (number | boolean) | undefined;
|
|
333
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export = LinkResolver;
|
|
2
|
+
declare class LinkResolver {
|
|
3
|
+
/** @type {Map<string, readonly string[]>} */
|
|
4
|
+
cache: Map<string, readonly string[]>;
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} file path to file or directory
|
|
7
|
+
* @returns {readonly string[]} array of file and all symlinks contributed in the resolving process (first item is the resolved file)
|
|
8
|
+
*/
|
|
9
|
+
resolve(file: string): readonly string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
declare namespace _exports {
|
|
2
|
+
export {
|
|
3
|
+
EventMap,
|
|
4
|
+
DirectoryWatcherOptions,
|
|
5
|
+
DirectoryWatcherEvents,
|
|
6
|
+
FileWatcherEvents,
|
|
7
|
+
Watcher,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare function _exports(options: DirectoryWatcherOptions): WatcherManager;
|
|
11
|
+
declare namespace _exports {
|
|
12
|
+
export { WatcherManager };
|
|
13
|
+
}
|
|
14
|
+
export = _exports;
|
|
15
|
+
type EventMap = import("./index").EventMap;
|
|
16
|
+
type DirectoryWatcherOptions =
|
|
17
|
+
import("./DirectoryWatcher").DirectoryWatcherOptions;
|
|
18
|
+
type DirectoryWatcherEvents =
|
|
19
|
+
import("./DirectoryWatcher").DirectoryWatcherEvents;
|
|
20
|
+
type FileWatcherEvents = import("./DirectoryWatcher").FileWatcherEvents;
|
|
21
|
+
type Watcher<T extends EventMap> = import("./DirectoryWatcher").Watcher<T>;
|
|
22
|
+
/** @typedef {import("./index").EventMap} EventMap */
|
|
23
|
+
/** @typedef {import("./DirectoryWatcher").DirectoryWatcherOptions} DirectoryWatcherOptions */
|
|
24
|
+
/** @typedef {import("./DirectoryWatcher").DirectoryWatcherEvents} DirectoryWatcherEvents */
|
|
25
|
+
/** @typedef {import("./DirectoryWatcher").FileWatcherEvents} FileWatcherEvents */
|
|
26
|
+
/**
|
|
27
|
+
* @template {EventMap} T
|
|
28
|
+
* @typedef {import("./DirectoryWatcher").Watcher<T>} Watcher
|
|
29
|
+
*/
|
|
30
|
+
declare class WatcherManager {
|
|
31
|
+
/**
|
|
32
|
+
* @param {DirectoryWatcherOptions=} options options
|
|
33
|
+
*/
|
|
34
|
+
constructor(options?: DirectoryWatcherOptions | undefined);
|
|
35
|
+
options: DirectoryWatcher.DirectoryWatcherOptions;
|
|
36
|
+
/** @type {Map<string, DirectoryWatcher>} */
|
|
37
|
+
directoryWatchers: Map<string, DirectoryWatcher>;
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} directory a directory
|
|
40
|
+
* @returns {DirectoryWatcher} a directory watcher
|
|
41
|
+
*/
|
|
42
|
+
getDirectoryWatcher(directory: string): DirectoryWatcher;
|
|
43
|
+
/**
|
|
44
|
+
* @param {string} file file
|
|
45
|
+
* @param {number=} startTime start time
|
|
46
|
+
* @returns {Watcher<FileWatcherEvents> | null} watcher or null if file has no directory
|
|
47
|
+
*/
|
|
48
|
+
watchFile(
|
|
49
|
+
file: string,
|
|
50
|
+
startTime?: number | undefined,
|
|
51
|
+
): Watcher<FileWatcherEvents> | null;
|
|
52
|
+
/**
|
|
53
|
+
* @param {string} directory directory
|
|
54
|
+
* @param {number=} startTime start time
|
|
55
|
+
* @returns {Watcher<DirectoryWatcherEvents>} watcher
|
|
56
|
+
*/
|
|
57
|
+
watchDirectory(
|
|
58
|
+
directory: string,
|
|
59
|
+
startTime?: number | undefined,
|
|
60
|
+
): Watcher<DirectoryWatcherEvents>;
|
|
61
|
+
}
|
|
62
|
+
import DirectoryWatcher = require("./DirectoryWatcher");
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
export = Watchpack;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {object} WatchpackEvents
|
|
4
|
+
* @property {(file: string, mtime: number, type: EventType) => void} change change event
|
|
5
|
+
* @property {(file: string, type: EventType) => void} remove remove event
|
|
6
|
+
* @property {(changes: Changes, removals: Removals) => void} aggregated aggregated event
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @extends {EventEmitter<{ [K in keyof WatchpackEvents]: Parameters<WatchpackEvents[K]> }>}
|
|
10
|
+
*/
|
|
11
|
+
declare class Watchpack extends EventEmitter<{
|
|
12
|
+
/**
|
|
13
|
+
* change event
|
|
14
|
+
*/
|
|
15
|
+
change: [file: string, mtime: number, type: EventType];
|
|
16
|
+
/**
|
|
17
|
+
* remove event
|
|
18
|
+
*/
|
|
19
|
+
remove: [file: string, type: EventType];
|
|
20
|
+
/**
|
|
21
|
+
* aggregated event
|
|
22
|
+
*/
|
|
23
|
+
aggregated: [changes: Changes, removals: Removals];
|
|
24
|
+
}> {
|
|
25
|
+
/**
|
|
26
|
+
* @param {WatchOptions=} options options
|
|
27
|
+
*/
|
|
28
|
+
constructor(options?: WatchOptions | undefined);
|
|
29
|
+
/** @type {WatchOptions} */
|
|
30
|
+
options: WatchOptions;
|
|
31
|
+
aggregateTimeout: number;
|
|
32
|
+
/** @type {NormalizedWatchOptions} */
|
|
33
|
+
watcherOptions: NormalizedWatchOptions;
|
|
34
|
+
/** @type {WatcherManager} */
|
|
35
|
+
watcherManager: WatcherManager;
|
|
36
|
+
/** @type {Map<string, WatchpackFileWatcher>} */
|
|
37
|
+
fileWatchers: Map<string, WatchpackFileWatcher>;
|
|
38
|
+
/** @type {Map<string, WatchpackDirectoryWatcher>} */
|
|
39
|
+
directoryWatchers: Map<string, WatchpackDirectoryWatcher>;
|
|
40
|
+
/** @type {Set<string>} */
|
|
41
|
+
_missing: Set<string>;
|
|
42
|
+
startTime: number | undefined;
|
|
43
|
+
paused: boolean;
|
|
44
|
+
/** @type {Changes} */
|
|
45
|
+
aggregatedChanges: Changes;
|
|
46
|
+
/** @type {Removals} */
|
|
47
|
+
aggregatedRemovals: Removals;
|
|
48
|
+
/** @type {undefined | NodeJS.Timeout} */
|
|
49
|
+
aggregateTimer: undefined | NodeJS.Timeout;
|
|
50
|
+
_onTimeout(): void;
|
|
51
|
+
/**
|
|
52
|
+
* @overload
|
|
53
|
+
* @param {Iterable<string>} arg1 files
|
|
54
|
+
* @param {Iterable<string>} arg2 directories
|
|
55
|
+
* @param {number=} arg3 startTime
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
watch(
|
|
59
|
+
arg1: Iterable<string>,
|
|
60
|
+
arg2: Iterable<string>,
|
|
61
|
+
arg3?: number | undefined,
|
|
62
|
+
): void;
|
|
63
|
+
/**
|
|
64
|
+
* @overload
|
|
65
|
+
* @param {WatchMethodOptions} arg1 watch options
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
68
|
+
watch(arg1: WatchMethodOptions): void;
|
|
69
|
+
close(): void;
|
|
70
|
+
pause(): void;
|
|
71
|
+
/**
|
|
72
|
+
* @returns {Record<string, number>} times
|
|
73
|
+
*/
|
|
74
|
+
getTimes(): Record<string, number>;
|
|
75
|
+
/**
|
|
76
|
+
* @returns {TimeInfoEntries} time info entries
|
|
77
|
+
*/
|
|
78
|
+
getTimeInfoEntries(): TimeInfoEntries;
|
|
79
|
+
/**
|
|
80
|
+
* @param {TimeInfoEntries} fileTimestamps file timestamps
|
|
81
|
+
* @param {TimeInfoEntries} directoryTimestamps directory timestamps
|
|
82
|
+
*/
|
|
83
|
+
collectTimeInfoEntries(
|
|
84
|
+
fileTimestamps: TimeInfoEntries,
|
|
85
|
+
directoryTimestamps: TimeInfoEntries,
|
|
86
|
+
): void;
|
|
87
|
+
/**
|
|
88
|
+
* @returns {Aggregated} aggregated info
|
|
89
|
+
*/
|
|
90
|
+
getAggregated(): Aggregated;
|
|
91
|
+
/**
|
|
92
|
+
* @param {string} item item
|
|
93
|
+
* @param {number} mtime mtime
|
|
94
|
+
* @param {string} file file
|
|
95
|
+
* @param {EventType} type type
|
|
96
|
+
*/
|
|
97
|
+
_onChange(item: string, mtime: number, file: string, type: EventType): void;
|
|
98
|
+
/**
|
|
99
|
+
* @param {string} item item
|
|
100
|
+
* @param {string} file file
|
|
101
|
+
* @param {EventType} type type
|
|
102
|
+
*/
|
|
103
|
+
_onRemove(item: string, file: string, type: EventType): void;
|
|
104
|
+
}
|
|
105
|
+
declare namespace Watchpack {
|
|
106
|
+
export {
|
|
107
|
+
WatcherManager,
|
|
108
|
+
DirectoryWatcher,
|
|
109
|
+
DirectoryWatcherEvents,
|
|
110
|
+
FileWatcherEvents,
|
|
111
|
+
EventMap,
|
|
112
|
+
Watcher,
|
|
113
|
+
IgnoredFunction,
|
|
114
|
+
Ignored,
|
|
115
|
+
WatcherOptions,
|
|
116
|
+
WatchOptions,
|
|
117
|
+
NormalizedWatchOptions,
|
|
118
|
+
EventType,
|
|
119
|
+
Entry,
|
|
120
|
+
OnlySafeTimeEntry,
|
|
121
|
+
ExistenceOnlyTimeEntry,
|
|
122
|
+
TimeInfoEntries,
|
|
123
|
+
Changes,
|
|
124
|
+
Removals,
|
|
125
|
+
Aggregated,
|
|
126
|
+
WatchMethodOptions,
|
|
127
|
+
Times,
|
|
128
|
+
WatchpackEvents,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
import { EventEmitter } from "events";
|
|
132
|
+
declare class WatchpackFileWatcher {
|
|
133
|
+
/**
|
|
134
|
+
* @param {Watchpack} watchpack watchpack
|
|
135
|
+
* @param {Watcher<FileWatcherEvents>} watcher watcher
|
|
136
|
+
* @param {string | string[]} files files
|
|
137
|
+
*/
|
|
138
|
+
constructor(
|
|
139
|
+
watchpack: Watchpack,
|
|
140
|
+
watcher: Watcher<FileWatcherEvents>,
|
|
141
|
+
files: string | string[],
|
|
142
|
+
);
|
|
143
|
+
/** @type {string[]} */
|
|
144
|
+
files: string[];
|
|
145
|
+
watcher: import("./DirectoryWatcher").Watcher<
|
|
146
|
+
import("./DirectoryWatcher").FileWatcherEvents
|
|
147
|
+
>;
|
|
148
|
+
/**
|
|
149
|
+
* @param {string | string[]} files files
|
|
150
|
+
*/
|
|
151
|
+
update(files: string | string[]): void;
|
|
152
|
+
close(): void;
|
|
153
|
+
}
|
|
154
|
+
declare class WatchpackDirectoryWatcher {
|
|
155
|
+
/**
|
|
156
|
+
* @param {Watchpack} watchpack watchpack
|
|
157
|
+
* @param {Watcher<DirectoryWatcherEvents>} watcher watcher
|
|
158
|
+
* @param {string} directories directories
|
|
159
|
+
*/
|
|
160
|
+
constructor(
|
|
161
|
+
watchpack: Watchpack,
|
|
162
|
+
watcher: Watcher<DirectoryWatcherEvents>,
|
|
163
|
+
directories: string,
|
|
164
|
+
);
|
|
165
|
+
/** @type {string[]} */
|
|
166
|
+
directories: string[];
|
|
167
|
+
watcher: import("./DirectoryWatcher").Watcher<
|
|
168
|
+
import("./DirectoryWatcher").DirectoryWatcherEvents
|
|
169
|
+
>;
|
|
170
|
+
/**
|
|
171
|
+
* @param {string | string[]} directories directories
|
|
172
|
+
*/
|
|
173
|
+
update(directories: string | string[]): void;
|
|
174
|
+
close(): void;
|
|
175
|
+
}
|
|
176
|
+
type WatcherManager = import("./getWatcherManager").WatcherManager;
|
|
177
|
+
type DirectoryWatcher = import("./DirectoryWatcher");
|
|
178
|
+
type DirectoryWatcherEvents =
|
|
179
|
+
import("./DirectoryWatcher").DirectoryWatcherEvents;
|
|
180
|
+
type FileWatcherEvents = import("./DirectoryWatcher").FileWatcherEvents;
|
|
181
|
+
type EventMap = Record<string, (...args: any[]) => any>;
|
|
182
|
+
type Watcher<T extends EventMap> = import("./DirectoryWatcher").Watcher<T>;
|
|
183
|
+
type IgnoredFunction = (item: string) => boolean;
|
|
184
|
+
type Ignored = string[] | RegExp | string | IgnoredFunction;
|
|
185
|
+
type WatcherOptions = {
|
|
186
|
+
/**
|
|
187
|
+
* true when need to resolve symlinks and watch symlink and real file, otherwise false
|
|
188
|
+
*/
|
|
189
|
+
followSymlinks?: boolean | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* ignore some files from watching (glob pattern or regexp)
|
|
192
|
+
*/
|
|
193
|
+
ignored?: Ignored | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* true when need to enable polling mode for watching, otherwise false
|
|
196
|
+
*/
|
|
197
|
+
poll?: (number | boolean) | undefined;
|
|
198
|
+
};
|
|
199
|
+
type WatchOptions = WatcherOptions & {
|
|
200
|
+
aggregateTimeout?: number;
|
|
201
|
+
};
|
|
202
|
+
type NormalizedWatchOptions = {
|
|
203
|
+
/**
|
|
204
|
+
* true when need to resolve symlinks and watch symlink and real file, otherwise false
|
|
205
|
+
*/
|
|
206
|
+
followSymlinks: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* ignore some files from watching (glob pattern or regexp)
|
|
209
|
+
*/
|
|
210
|
+
ignored: IgnoredFunction;
|
|
211
|
+
/**
|
|
212
|
+
* true when need to enable polling mode for watching, otherwise false
|
|
213
|
+
*/
|
|
214
|
+
poll?: (number | boolean) | undefined;
|
|
215
|
+
};
|
|
216
|
+
type EventType =
|
|
217
|
+
| `scan (${string})`
|
|
218
|
+
| "change"
|
|
219
|
+
| "rename"
|
|
220
|
+
| `watch ${string}`
|
|
221
|
+
| `directory-removed ${string}`;
|
|
222
|
+
type Entry = {
|
|
223
|
+
safeTime: number;
|
|
224
|
+
timestamp: number;
|
|
225
|
+
accuracy: number;
|
|
226
|
+
};
|
|
227
|
+
type OnlySafeTimeEntry = {
|
|
228
|
+
safeTime: number;
|
|
229
|
+
};
|
|
230
|
+
type ExistenceOnlyTimeEntry = {};
|
|
231
|
+
type TimeInfoEntries = Map<
|
|
232
|
+
string,
|
|
233
|
+
Entry | OnlySafeTimeEntry | ExistenceOnlyTimeEntry | null
|
|
234
|
+
>;
|
|
235
|
+
type Changes = Set<string>;
|
|
236
|
+
type Removals = Set<string>;
|
|
237
|
+
type Aggregated = {
|
|
238
|
+
changes: Changes;
|
|
239
|
+
removals: Removals;
|
|
240
|
+
};
|
|
241
|
+
type WatchMethodOptions = {
|
|
242
|
+
files?: Iterable<string>;
|
|
243
|
+
directories?: Iterable<string>;
|
|
244
|
+
missing?: Iterable<string>;
|
|
245
|
+
startTime?: number;
|
|
246
|
+
};
|
|
247
|
+
type Times = Record<string, number>;
|
|
248
|
+
type WatchpackEvents = {
|
|
249
|
+
/**
|
|
250
|
+
* change event
|
|
251
|
+
*/
|
|
252
|
+
change: (file: string, mtime: number, type: EventType) => void;
|
|
253
|
+
/**
|
|
254
|
+
* remove event
|
|
255
|
+
*/
|
|
256
|
+
remove: (file: string, type: EventType) => void;
|
|
257
|
+
/**
|
|
258
|
+
* aggregated event
|
|
259
|
+
*/
|
|
260
|
+
aggregated: (changes: Changes, removals: Removals) => void;
|
|
261
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare namespace _exports {
|
|
2
|
+
export { TreeNode };
|
|
3
|
+
}
|
|
4
|
+
declare function _exports<T>(
|
|
5
|
+
plan: Map<string, T[] | T>,
|
|
6
|
+
limit: number,
|
|
7
|
+
): Map<string, Map<T, string>>;
|
|
8
|
+
export = _exports;
|
|
9
|
+
type TreeNode<T> = {
|
|
10
|
+
/**
|
|
11
|
+
* target
|
|
12
|
+
*/
|
|
13
|
+
target: string;
|
|
14
|
+
/**
|
|
15
|
+
* parent
|
|
16
|
+
*/
|
|
17
|
+
parent: TreeNode<T>;
|
|
18
|
+
/**
|
|
19
|
+
* children
|
|
20
|
+
*/
|
|
21
|
+
children: TreeNode<T>[];
|
|
22
|
+
/**
|
|
23
|
+
* number of entries
|
|
24
|
+
*/
|
|
25
|
+
entries: number;
|
|
26
|
+
/**
|
|
27
|
+
* true when active, otherwise false
|
|
28
|
+
*/
|
|
29
|
+
active: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* value
|
|
32
|
+
*/
|
|
33
|
+
value: T[] | T | undefined;
|
|
34
|
+
};
|