forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser-sync.d.ts
117 lines (103 loc) · 3.34 KB
/
browser-sync.d.ts
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
// Type definitions for browser-sync
// Project: http://www.browsersync.io/
// Definitions by: Asana <https://asana.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../chokidar/chokidar.d.ts"/>
/// <reference path="../node/node.d.ts" />
declare module "browser-sync" {
import chokidar = require("chokidar");
import fs = require("fs");
import http = require("http");
interface Options {
files?: string | string[];
watchOptions?: GazeOptions;
server?: ServerOptions;
proxy?: string | boolean;
port?: number;
https?: boolean;
ghostMode?: GhostOptions | boolean;
logLevel?: string;
logPrefix?: string;
logConnections?: boolean;
logFileChanges?: boolean;
logSnippet?: boolean;
snippetOptions?: SnippetOptions;
rewriteRules?: boolean | RewriteRules[];
tunnel?: string | boolean;
online?: boolean;
open?: string | boolean;
browser?: string | string[];
xip?: boolean;
notify?: boolean;
scrollProportionally?: boolean;
scrollThrottle?: number;
reloadDelay?: number;
reloadDebounce?: number;
plugins?: any[];
injectChanges?: boolean;
startPath?: string;
minify?: boolean;
host?: string;
codeSync?: boolean;
timestamps?: boolean;
scriptPath?: (path: string) => string;
socket?: SocketOptions;
}
interface GazeOptions {
interval?: number;
debounceDelay?: number;
mode?: string;
cwd?: string;
}
interface ServerOptions {
baseDir?: string | string[];
directory?: boolean;
index?: string;
routes?: {[path: string]: string};
middleware?: MiddlewareHandler[];
}
interface MiddlewareHandler {
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
}
interface GhostOptions {
clicks?: boolean;
scroll?: boolean;
forms?: boolean;
}
interface SnippetOptions {
ignorePaths?: string;
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
}
interface SocketOptions {
path?: string;
clientPath?: string;
namespace?: string;
}
interface RewriteRules {
match: RegExp;
fn: (match: string) => string;
}
module browserSync {
interface BrowserSync {
init(config?: Options, callback?: (err: Error, bs: Object) => any): void;
reload(): void;
reload(file: string): void;
reload(files: string[]): void;
reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
notify(message: string, timeout?: number): void;
exit(): void;
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any): NodeJS.EventEmitter;
pause(): void;
resume(): void;
emitter: NodeJS.EventEmitter;
active: boolean;
paused: boolean;
}
}
interface Exports extends browserSync.BrowserSync {
create(): browserSync.BrowserSync;
(config?: Options, callback?: (err: Error, bs: Object) => any): void;
}
var browserSync: Exports;
export = browserSync;
}