Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smart-restart

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-restart - npm Package Compare versions

Comparing version 2.6.0-beta.4 to 2.6.0

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc