|
1 | 1 | import { EventEmitter } from "events"; |
2 | 2 |
|
3 | 3 | declare global { |
4 | | - // This interface is a mashup of NodeJS' along with Chokidar's event watchers |
5 | | - interface IFSWatcher extends NodeJS.EventEmitter { |
6 | | - // from fs.FSWatcher |
7 | | - close(): void; |
8 | | - |
9 | | - /** |
10 | | - * events.EventEmitter |
11 | | - * 1. change |
12 | | - * 2. error |
13 | | - */ |
14 | | - addListener(event: string, listener: Function): this; |
15 | | - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; |
16 | | - addListener(event: "error", listener: (code: number, signal: string) => void): this; |
17 | | - |
18 | | - on(event: string, listener: Function): this; |
19 | | - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; |
20 | | - on(event: "error", listener: (code: number, signal: string) => void): this; |
21 | | - |
22 | | - once(event: string, listener: Function): this; |
23 | | - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; |
24 | | - once(event: "error", listener: (code: number, signal: string) => void): this; |
25 | | - |
26 | | - prependListener(event: string, listener: Function): this; |
27 | | - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; |
28 | | - prependListener(event: "error", listener: (code: number, signal: string) => void): this; |
29 | | - |
30 | | - prependOnceListener(event: string, listener: Function): this; |
31 | | - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; |
32 | | - prependOnceListener(event: "error", listener: (code: number, signal: string) => void): this; |
33 | | - |
34 | | - // From chokidar FSWatcher |
35 | | - |
36 | | - /** |
37 | | - * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one |
38 | | - * string. |
39 | | - */ |
40 | | - add(paths: string | string[]): void; |
41 | | - |
42 | | - /** |
43 | | - * Stop watching files, directories, or glob patterns. Takes an array of strings or just one |
44 | | - * string. |
45 | | - */ |
46 | | - unwatch(paths: string | string[]): void; |
47 | | - |
48 | | - /** |
49 | | - * Returns an object representing all the paths on the file system being watched by this |
50 | | - * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless |
51 | | - * the `cwd` option was used), and the values are arrays of the names of the items contained in |
52 | | - * each directory. |
53 | | - */ |
54 | | - getWatched(): IDictionary<string[]>; |
55 | | - |
56 | | - /** |
57 | | - * Removes all listeners from watched files. |
58 | | - */ |
59 | | - close(): void; |
60 | | - } |
61 | | - |
62 | 4 | interface ILiveSyncProcessInfo { |
63 | 5 | timer: NodeJS.Timer; |
64 | | - watcherInfo: { |
65 | | - watcher: IFSWatcher, |
66 | | - patterns: string[] |
67 | | - }; |
68 | 6 | actionsChain: Promise<any>; |
69 | 7 | isStopped: boolean; |
70 | 8 | deviceDescriptors: ILiveSyncDeviceInfo[]; |
@@ -131,18 +69,16 @@ declare global { |
131 | 69 | debugggingEnabled?: boolean; |
132 | 70 | } |
133 | 71 |
|
134 | | - interface IOptionalSkipWatcher { |
135 | | - /** |
136 | | - * Defines if the watcher should be skipped. If not passed, fs.Watcher will be started. |
137 | | - */ |
138 | | - skipWatcher?: boolean; |
139 | | - } |
140 | | - |
141 | 72 | /** |
142 | 73 | * Describes a LiveSync operation. |
143 | 74 | */ |
144 | | - interface ILiveSyncInfo extends IProjectDir, IEnvOptions, IRelease, IOptionalSkipWatcher, IHasUseHotModuleReloadOption, IHasSyncToPreviewAppOption { |
| 75 | + interface ILiveSyncInfo extends IProjectDir, IEnvOptions, IRelease, IHasUseHotModuleReloadOption, IHasSyncToPreviewAppOption { |
145 | 76 | emulator?: boolean; |
| 77 | + |
| 78 | + /** |
| 79 | + * Defines if the watcher should be skipped. If not passed, fs.Watcher will be started. |
| 80 | + */ |
| 81 | + skipWatcher?: boolean; |
146 | 82 |
|
147 | 83 | /** |
148 | 84 | * Forces a build before the initial livesync. |
@@ -189,43 +125,14 @@ declare global { |
189 | 125 | isFullSync?: boolean |
190 | 126 | } |
191 | 127 |
|
192 | | - interface ILatestAppPackageInstalledSettings extends IDictionary<IDictionary<boolean>> { /* empty */ } |
193 | | - |
194 | 128 | interface IIsEmulator { |
195 | 129 | isEmulator: boolean; |
196 | 130 | } |
197 | 131 |
|
198 | | - interface ILiveSyncBuildInfo extends IIsEmulator, IPlatform { |
199 | | - pathToBuildItem: string; |
200 | | - } |
201 | | - |
202 | 132 | interface IProjectDataComposition { |
203 | 133 | projectData: IProjectData; |
204 | 134 | } |
205 | 135 |
|
206 | | - /** |
207 | | - * Desribes object that can be passed to ensureLatestAppPackageIsInstalledOnDevice method. |
208 | | - */ |
209 | | - interface IEnsureLatestAppPackageIsInstalledOnDeviceOptions extends IProjectDataComposition, IEnvOptions, IBundle, IRelease, IOptionalFilesToRemove, IOptionalFilesToSync { |
210 | | - device: Mobile.IDevice; |
211 | | - preparedPlatforms: string[]; |
212 | | - rebuiltInformation: ILiveSyncBuildInfo[]; |
213 | | - deviceBuildInfoDescriptor: ILiveSyncDeviceInfo; |
214 | | - settings: ILatestAppPackageInstalledSettings; |
215 | | - liveSyncData?: ILiveSyncInfo; |
216 | | - modifiedFiles?: string[]; |
217 | | - } |
218 | | - |
219 | | - /** |
220 | | - * Describes the action that has been executed during ensureLatestAppPackageIsInstalledOnDevice execution. |
221 | | - */ |
222 | | - interface IAppInstalledOnDeviceResult { |
223 | | - /** |
224 | | - * Defines if the app has been installed on device from the ensureLatestAppPackageIsInstalledOnDevice method. |
225 | | - */ |
226 | | - appInstalled: boolean; |
227 | | - } |
228 | | - |
229 | 136 | /** |
230 | 137 | * Describes LiveSync operations. |
231 | 138 | */ |
@@ -401,6 +308,7 @@ declare global { |
401 | 308 | shouldRestart(projectData: IProjectData, liveSyncInfo: ILiveSyncResultInfo): Promise<boolean>; |
402 | 309 | getDeviceLiveSyncService(device: Mobile.IDevice, projectData: IProjectData): INativeScriptDeviceLiveSyncService; |
403 | 310 | } |
| 311 | + |
404 | 312 | interface IRestartApplicationInfo { |
405 | 313 | didRestart: boolean; |
406 | 314 | } |
|
0 commit comments