Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thgh committed Nov 1, 2020
1 parent 2c4c239 commit 0593bfa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down
15 changes: 4 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default {
file: 'dest.js',
format: 'cjs'
},
watch: {
clearScreen: false,
},
plugins: [
serve({
open: true,
Expand Down

0 comments on commit 0593bfa

Please sign in to comment.