Comparing version 5.0.0 to 5.1.0
# node-dev | ||
## v5.1.0 / 2020-07-28 | ||
- [wrap.js] Improve uncaughtException handling to turn non-errors into errors (Fixes #231) | ||
- [ipc.js] Declare `NODE_DEV` as a variable | ||
- [ipc.js] Inline single line function only used twice | ||
- [tests] Filenames should be snake-case | ||
## v5.0.0 / 2020-07-08 | ||
@@ -4,0 +11,0 @@ |
@@ -1,7 +0,2 @@ | ||
/** | ||
* Checks if the given message is an internal node-dev message. | ||
*/ | ||
function isNodeDevMessage(m) { | ||
return m.cmd === 'NODE_DEV'; | ||
} | ||
const NODE_DEV = 'NODE_DEV'; | ||
@@ -12,3 +7,3 @@ /** | ||
exports.send = function (m, dest) { | ||
m.cmd = 'NODE_DEV'; | ||
m.cmd = NODE_DEV; | ||
if (!dest) dest = process; | ||
@@ -20,3 +15,3 @@ if (dest.send) dest.send(m); | ||
function handleMessage(m) { | ||
if (isNodeDevMessage(m) && type in m) cb(m); | ||
if (m.cmd === NODE_DEV && type in m) cb(m); | ||
} | ||
@@ -30,3 +25,3 @@ proc.on('internalMessage', handleMessage); | ||
function relayMessage(m) { | ||
if (isNodeDevMessage(m)) dest.send(m); | ||
if (m.cmd === NODE_DEV) dest.send(m); | ||
} | ||
@@ -33,0 +28,0 @@ src.on('internalMessage', relayMessage); |
@@ -38,11 +38,12 @@ const path = require('path'); | ||
process.on('uncaughtException', function (err) { | ||
console.error(err.stack || err); | ||
// Sometimes uncaught exceptions are not errors | ||
const { message, name, stack } = err instanceof Error ? err : new Error(`uncaughtException ${err}`); | ||
console.error(stack); | ||
// If there's a custom uncaughtException handler expect it to terminate | ||
// the process. | ||
const hasCustomHandler = process.listeners('uncaughtException').length > 1; | ||
ipc.send({ | ||
error: err.name || 'Error', | ||
message: err.message, | ||
willTerminate: hasCustomHandler | ||
}); | ||
const willTerminate = process.listeners('uncaughtException').length > 1; | ||
ipc.send({ error: name, message, willTerminate }); | ||
}); | ||
@@ -49,0 +50,0 @@ |
{ | ||
"name": "node-dev", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Restarts your app when files are modified", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
29791
435