Comparing version 2.6.2 to 2.7.0
@@ -9,2 +9,6 @@ var fs = require('fs') | ||
function resolvePath(unresolvedPath) { | ||
return path.resolve(process.cwd(), unresolvedPath) | ||
} | ||
module.exports = function(main, opts) { | ||
@@ -26,2 +30,4 @@ var dir = main ? path.dirname(main) : '.' | ||
var ignore = (c.ignore || []).map(resolvePath) | ||
return { | ||
@@ -35,2 +41,3 @@ vm : c.vm !== false, | ||
dedupe : !!c.dedupe, | ||
ignore : ignore, | ||
extensions : c.extensions || { | ||
@@ -37,0 +44,0 @@ coffee: "coffee-script/register", |
@@ -5,15 +5,22 @@ var fork = require('child_process').fork | ||
var ipc = require('./ipc') | ||
var cli = require('./cli') | ||
var resolveMain = require('./resolveMain') | ||
module.exports = function(args) { | ||
module.exports = function(wrapper, script, scriptArgs, opts) { | ||
if (typeof wrapper !== 'string' || wrapper.length === 0) { | ||
throw new TypeError('`wrapper` must be a string') | ||
} | ||
if (typeof script !== 'string' || script.length === 0) { | ||
throw new TypeError('`script` must be a string') | ||
} | ||
if (!Array.isArray(scriptArgs)) { | ||
throw new TypeError('`scriptArgs` must be an array') | ||
} | ||
// The child_process | ||
var child | ||
// Parse command line options | ||
var opts = cli.parseOpts(args) | ||
// Inject wrap.js into the args array | ||
var main = cli.injectScript(args, __dirname + '/wrap.js') | ||
var main = resolveMain(script) | ||
var cfg = require('./cfg')(main, opts) | ||
@@ -54,3 +61,4 @@ var log = require('./log')(cfg) | ||
function start() { | ||
child = fork(args[0], args.slice(1), { | ||
var wrapperArgs = [script].concat(scriptArgs) | ||
child = fork(wrapper, wrapperArgs, { | ||
cwd: process.cwd(), | ||
@@ -66,3 +74,5 @@ env: process.env | ||
ipc.on(child, 'required', function(m) { | ||
if (cfg.deps == -1 || getLevel(m.required) <= cfg.deps) { | ||
var isIgnored = cfg.ignore.some(isPrefixOf(m.required)) | ||
if (!isIgnored && (cfg.deps == -1 || getLevel(m.required) <= cfg.deps)) { | ||
watcher.add(m.required) | ||
@@ -113,1 +123,7 @@ } | ||
} | ||
function isPrefixOf(value) { | ||
return function (prefix) { | ||
return value.indexOf(prefix) === 0 | ||
} | ||
} |
@@ -8,3 +8,3 @@ var path = require('path') | ||
var cfg = require('./cfg') | ||
var cli = require('./cli') | ||
var resolveMain = require('./resolveMain') | ||
@@ -15,3 +15,3 @@ // Remove wrap.js from the argv array | ||
// Resolve the location of the main script relative to cwd | ||
var main = cli.resolveMain(process.argv[1]) | ||
var main = resolveMain(process.argv[1]) | ||
@@ -18,0 +18,0 @@ var cfg = require('./cfg')(main) |
{ | ||
"name": "node-dev", | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"description": "Restarts your app when files are modified", | ||
@@ -13,2 +13,5 @@ "keywords": [ | ||
"author": "Felix Gnass", | ||
"contributors": [ | ||
"Daniel Gasienica <daniel@gasienica.ch> (https://github.com/gasi/)" | ||
], | ||
"repository": { | ||
@@ -31,2 +34,3 @@ "type": "git", | ||
"dependencies": { | ||
"commander": "^2.8.1", | ||
"dateformat": "~1.0.4-1.2.3", | ||
@@ -40,4 +44,5 @@ "dynamic-dedupe": "^0.2.0", | ||
"coffee-script": "^1.8.0", | ||
"tap": "^0.4.13" | ||
"tap": "^1.3.2", | ||
"touch": "^1.0.0" | ||
} | ||
} |
@@ -126,24 +126,28 @@ [![Build Status](https://secure.travis-ci.org/fgnass/node-dev.png)](http://travis-ci.org/fgnass/node-dev) | ||
## License | ||
### Ignore paths | ||
### The MIT License (MIT) | ||
If you’d like to ignore certain paths or files from triggering a restart simply | ||
list them in the `.node-dev.json` configuration under `"ignore"`, e.g. | ||
Copyright (c) 2014 Felix Gnass | ||
```json | ||
{ | ||
"ignore": [ | ||
"client/scripts", | ||
"shared/module.js" | ||
] | ||
} | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
``` | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
This might be useful when you are running a [universal][universal-javascript] | ||
(isomorphic) web app that shares modules across the server and client, e.g. | ||
[React.js](react) components for server-side rendering, which you don’t want to trigger a | ||
server restart when changed, since it introduces an unnecessary delay. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
## License | ||
MIT | ||
[react]: http://facebook.github.io/react/ | ||
[universal-javascript]: https://medium.com/@mjackson/universal-javascript-4761051b7ae9 |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
21055
19
153
6
3
333
3
+ Addedcommander@^2.8.1
+ Addedcommander@2.20.3(transitive)