smart-restart
Advanced tools
Comparing version 2.6.0-beta.4 to 2.6.0
{ | ||
"name": "smart-restart", | ||
"version": "2.6.0-beta.4", | ||
"version": "2.6.0", | ||
"description": "Like nodemon but only watches require()d files. Like piping but easy to use with node-inspector.", | ||
@@ -5,0 +5,0 @@ "engines": { |
# smart-restart | ||
CommonJS module load hook that restarts or does Webpack-style hot module replacement when a file is changed | ||
[![CircleCI](https://circleci.com/gh/jedwards1211/smart-restart.svg?style=svg)](https://circleci.com/gh/jedwards1211/smart-restart) | ||
@@ -18,4 +20,9 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
On top of that, neither supports any hot module replacement, which is the only way to react to changes quickly in a | ||
large project. | ||
`smart-restart` combines both approaches: it uses `piping`'s require hook to only watch files that have been required, | ||
but it `spawns` your app instead of running a cluster, so that you can pass `--debug` or `--debug-brk` to your app. | ||
And it provides a basic version of Webpack's hot module replacement API for Node CommonJS, without using Webpack or | ||
doing any bundling. | ||
@@ -55,2 +62,20 @@ ## Usage | ||
## Hot Module Replacement | ||
`smart-restart` supports the following subset of Webpack's hot module replacement API: | ||
```js | ||
if (module.hot) { | ||
module.hot.accept('./myModule', () => { | ||
const newVersion = require('./myModule') | ||
// do something with newVersion | ||
}) | ||
} | ||
``` | ||
Webpack's other overloads for `module.hot.accept` aren't supported. | ||
If not all ancestors of a changed module have `module.hot.accept` hooks, then `smart-restart` will | ||
relaunch the whole process. | ||
## Exiting for good | ||
@@ -57,0 +82,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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24222
0
83