Comparing version 0.1.1 to 0.1.2
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.1.2](https://github.com/nuxt-contrib/listhen/compare/v0.1.1...v0.1.2) (2020-12-07) | ||
### Bug Fixes | ||
* graceful shutdown ([#6](https://github.com/nuxt-contrib/listhen/issues/6)) ([3e1e001](https://github.com/nuxt-contrib/listhen/commit/3e1e0019539f9e988ba9fd14fb366fcb79d18193)) | ||
### [0.1.1](https://github.com/nuxt-contrib/listhen/compare/v0.1.0...v0.1.1) (2020-12-07) | ||
@@ -7,0 +14,0 @@ |
@@ -15,2 +15,3 @@ 'use strict'; | ||
const clipboardy2 = require('clipboardy'); | ||
const addShutdown = require('http-shutdown'); | ||
const ufo = require('@nuxt/ufo'); | ||
@@ -26,2 +27,3 @@ | ||
const clipboardy2__default = /*#__PURE__*/_interopDefaultLegacy(clipboardy2); | ||
const addShutdown__default = /*#__PURE__*/_interopDefaultLegacy(addShutdown); | ||
@@ -38,4 +40,3 @@ async function listen(handle, opts = {}) { | ||
isProd: process.env.NODE_ENV === "production", | ||
autoClose: true, | ||
autoCloseSignals: ["exit", "SIGINT", "SIGUSR1", "SIGUSR2", "SIGTERM"] | ||
autoClose: true | ||
}); | ||
@@ -55,2 +56,3 @@ if (opts.isTest) { | ||
server = https2__default['default'].createServer({key, cert}, handle); | ||
addShutdown__default['default'](server); | ||
await util.promisify(server.listen.bind(server))(port); | ||
@@ -60,2 +62,3 @@ url = `https://localhost:${port}${opts.baseURL}`; | ||
server = http2__default['default'].createServer(handle); | ||
addShutdown__default['default'](server); | ||
await util.promisify(server.listen.bind(server))(port); | ||
@@ -70,3 +73,3 @@ url = `http://localhost:${port}${opts.baseURL}`; | ||
_closed = true; | ||
return util.promisify(server.close.bind(server))(); | ||
return util.promisify(server.shutdown)(); | ||
}; | ||
@@ -88,5 +91,3 @@ if (opts.clipboard) { | ||
if (opts.autoClose) { | ||
for (const signal of opts.autoCloseSignals) { | ||
process.on(signal, close); | ||
} | ||
process.on("exit", () => close()); | ||
} | ||
@@ -93,0 +94,0 @@ return { |
{ | ||
"name": "listhen", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -25,2 +25,3 @@ "repository": "nuxt-contrib/listhen", | ||
"get-port-please": "^2.1.0", | ||
"http-shutdown": "^1.2.2", | ||
"open": "^7.3.0", | ||
@@ -27,0 +28,0 @@ "selfsigned": "^1.10.8" |
@@ -30,4 +30,6 @@ # 👂 listhen | ||
✔️ Automatically close with process shutdown signal | ||
✔️ Automatically close on exit signal | ||
✔️ Gracefully shutdown server with [http-shutdown](https://github.com/thedillonb/http-shutdown) | ||
## Install | ||
@@ -144,8 +146,2 @@ | ||
### `autoCloseSignals` | ||
- Default: `['exit', 'SIGINT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM']` | ||
Signals to auto close. | ||
## License | ||
@@ -152,0 +148,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12940
151
8
161
3
+ Addedhttp-shutdown@^1.2.2
+ Addedhttp-shutdown@1.2.2(transitive)