Skip to content

Commit 0154280

Browse files
authored
Merge pull request #34 from kuzivany/jsdoc
Add Intellisense
2 parents 1ea9096 + b139780 commit 0154280

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

src/index.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import opener from 'opener'
88

99
let server
1010

11-
export default function serve (options = { contentBase: '' }) {
11+
/**
12+
* Serve your rolled up bundle like webpack-dev-server
13+
* @param {ServeOptions|string|string[]} options
14+
*/
15+
function serve (options = { contentBase: '' }) {
1216
if (Array.isArray(options) || typeof options === 'string') {
1317
options = { contentBase: options }
1418
}
@@ -136,3 +140,26 @@ function closeServerOnTermination (server) {
136140
})
137141
})
138142
}
143+
144+
export default serve
145+
146+
/**
147+
* @typedef {Object} ServeOptions
148+
* @property {boolean} [open=false] Launch in browser (default: `false`)
149+
* @property {string} [openPage=''] Page to navigate to when opening the browser. Will not do anything if `open` is `false`. Remember to start with a slash e.g. `'/different/page'`
150+
* @property {boolean} [verbose=true] Show server address in console (default: `true`)
151+
* @property {string|string[]} [contentBase=''] Folder(s) to serve files from
152+
* @property {string|boolean} [historyApiFallback] Path to fallback page. Set to `true` to return index.html (200) instead of error page (404)
153+
* @property {string} [host='localhost'] Server host (default: `'localhost'`)
154+
* @property {number} [port=10001] Server port (default: `10001`)
155+
* @property {ServeOptionsHttps} [https=false] By default server will be served over HTTP (https: `false`). It can optionally be served over HTTPS
156+
* @property {{[header:string]: string}} [headers] Set headers
157+
*/
158+
159+
/**
160+
* @typedef {Object} ServeOptionsHttps
161+
* @property {string|Buffer|Buffer[]|Object[]} key
162+
* @property {string|Buffer|Array<string|Buffer>} cert
163+
* @property {string|Buffer|Array<string|Buffer>} ca
164+
* @see https.ServerOptions
165+
*/

0 commit comments

Comments
 (0)