diff --git a/CHANGELOG.md b/CHANGELOG.md index b2af651..6f49503 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to `rollup-plugin-serve` will be documented in this file. +## [1.1.0] - 2020-11-01 +### Added +- Add `onListening` hook #69 @filoxo +- Show error message when port is in use #60 @jaeh + +## [1.0.4] - 2020-08-28 +### Added +- Add `mimeTypes` option #58 @GerardRodes + +### Fixed +- Allow opening the browser even when verbose mode is disabled #64 @Richienb + ## [1.0.3] - 2020-07-21 ### Fixed - Fix path.normalize error on Windows diff --git a/package.json b/package.json index 4ad0c3f..ac8d15a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup-plugin-serve", - "version": "1.0.4", + "version": "1.1.0", "description": "Serve your rolled up bundle", "main": "dist/index.cjs.js", "module": "dist/index.es.js", diff --git a/rollup.config.js b/rollup.config.js index 2a35ebc..4fe5059 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,7 +3,7 @@ import buble from '@rollup/plugin-buble' export default { input: 'src/index.js', output: [ - { file: 'dist/index.cjs.js', format: 'cjs' }, + { file: 'dist/index.cjs.js', format: 'cjs', exports: 'default' }, { file: 'dist/index.es.js', format: 'esm' } ], plugins: [buble()], diff --git a/src/index.js b/src/index.js index a3c936b..e10ed71 100644 --- a/src/index.js +++ b/src/index.js @@ -74,17 +74,10 @@ function serve (options = { contentBase: '' }) { } // If HTTPS options are available, create an HTTPS server - if (options.https) { - server = createHttpsServer(options.https, requestListener) - server.listen(options.port, options.host, () => { - options.onListening(server) - }) - } else { - server = createServer(requestListener) - server.listen(options.port, options.host, () => { - options.onListening(server) - }) - } + server = options.https + ? createHttpsServer(options.https, requestListener) + : createServer(requestListener) + server.listen(options.port, options.host, () => options.onListening(server)) // Assemble url for error and info messages const url = (options.https ? 'https' : 'http') + '://' + (options.host || 'localhost') + ':' + options.port diff --git a/test/rollup.config.js b/test/rollup.config.js index 83e5396..1ba0a4d 100644 --- a/test/rollup.config.js +++ b/test/rollup.config.js @@ -19,6 +19,9 @@ export default { file: 'dest.js', format: 'cjs' }, + watch: { + clearScreen: false, + }, plugins: [ serve({ open: true,