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

livereload

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

livereload - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

20

lib/command.js

@@ -6,3 +6,3 @@ // Generated by CoffeeScript 1.10.0

runner = function() {
var debug, exclusions, exts, livereload, opts, path, pjson, port, resolve, server, usePolling, version;
var debug, exclusions, exts, livereload, opts, path, pjson, port, resolve, server, usePolling, version, wait;
pjson = require('../package.json');

@@ -56,8 +56,17 @@ version = pjson.version;

value: true
}, {
short: "w",
long: "wait",
description: "delay message of file system changes to browser by `delay` milliseconds",
required: false,
value: true
}
].reverse(), true);
port = opts.get('port') || 35729;
exclusions = opts.get('exclusions') || [];
exclusions = opts.get('exclusions') ? opts.get('exclusions').split(',').map(function(s) {
return new RegExp(s);
}) : [];
exts = (opts.get('exts') || '').split(' ');
usePolling = opts.get('usepolling') || false;
wait = opts.get('wait') || 0;
server = livereload.createServer({

@@ -68,5 +77,8 @@ port: port,

exts: exts,
usePolling: usePolling
usePolling: usePolling,
delay: wait
});
path = resolve(process.argv[2] || '.');
path = (process.argv[2] || '.').split(/\s*,\s*/).map(function(x) {
return resolve(x);
});
console.log("Starting LiveReload v" + version + " for " + path + " on port " + port + ".");

@@ -73,0 +85,0 @@ return server.watch(path);

45

lib/livereload.js

@@ -106,38 +106,25 @@ // Generated by CoffeeScript 1.10.0

Server.prototype.watch = function(paths) {
this.watcher = chokidar.watch(paths, {
return this.watcher = chokidar.watch(paths, {
ignoreInitial: true,
ignored: this.config.exclusions,
usePolling: this.config.usePolling
});
this.watcher.on('add', (function(_this) {
return function(path) {
return _this.filterRefresh(path);
};
})(this));
this.watcher.on('change', (function(_this) {
return function(path) {
return _this.filterRefresh(path);
};
})(this));
return this.watcher.on('unlink', (function(_this) {
return function(path) {
return _this.filterRefresh(path);
};
})(this));
}).on('add', this.filterRefresh.bind(this)).on('change', this.filterRefresh.bind(this)).on('unlink', this.filterRefresh.bind(this));
};
Server.prototype.filterRefresh = function(filepath) {
var ext, exts, fileext, i, len, results;
var delayedRefresh, exts, fileext;
exts = this.config.exts;
fileext = path.extname(filepath).substring(1);
results = [];
for (i = 0, len = exts.length; i < len; i++) {
ext = exts[i];
if (!(ext === fileext)) {
continue;
if (exts.indexOf(fileext) !== -1) {
if (this.config.delay) {
return delayedRefresh = setTimeout((function(_this) {
return function() {
clearTimeout(delayedRefresh);
return _this.refresh(filepath);
};
})(this), this.config.delay);
} else {
return this.refresh(filepath);
}
this.refresh(filepath);
break;
}
return results;
};

@@ -179,2 +166,8 @@

Server.prototype.close = function() {
this.watcher.close();
this.server._server.close();
return this.server.close();
};
return Server;

@@ -181,0 +174,0 @@

@@ -1,32 +0,43 @@

{ "name": "livereload"
, "description": "LiveReload server"
, "version": "0.4.1"
, "contributors": [
{ "name": "Brian P. Hogan", "email": "brianhogan@napcs.com" }
]
, "licenses": [
{ "type": "MIT"
, "url": "https://github.com/napcs/node-livereload/blob/master/LICENSE"
}]
, "repository":
{ "type": "git"
, "url": "http://github.com/napcs/node-livereload.git"
}
, "bin": { "livereload": "./bin/livereload.js" }
, "main": "./lib/livereload.js"
, "dependencies": {
{
"name": "livereload",
"description": "LiveReload server",
"version": "0.5.0",
"contributors": [
{
"name": "Brian P. Hogan",
"email": "brianhogan@napcs.com"
}
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/napcs/node-livereload/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "http://github.com/napcs/node-livereload.git"
},
"bin": {
"livereload": "./bin/livereload.js"
},
"main": "./lib/livereload.js",
"dependencies": {
"chokidar": "^1.1.0",
"opts": ">= 1.2.0",
"ws": "^0.8.0"
}
, "devDependencies": {
},
"devDependencies": {
"coffee-script": ">= 1.8.0",
"mocha": ">= 1.0.3",
"request": ">= 2.9.203",
"should": ">= 0.6.3",
"mocha": ">= 1.0.3",
"coffee-script": ">= 1.8.0"
}
, "engines" : { "node" : ">=0.4.0" }
, "scripts": {
"sinon": "^1.17.4"
},
"engines": {
"node": ">=0.4.0"
},
"scripts": {
"test": "mocha"
}
}

@@ -92,2 +92,8 @@

Command line:
```sh
$ livereload "path1, path2, path3"
```
## Using the `originalPath` option:

@@ -112,3 +118,3 @@

<head>
<link rel="stylesheet" href="http://domain.com/css/style.css">
<link rel="stylesheet" href="http://domain.com/css/style.css">
</head>

@@ -125,4 +131,5 @@ ```

* `-d` or `--debug` to show debug messages when the browser reloads.
* `-e` or `--exts` to include additional extentions that you want to observe. An example being -e 'jade scss'.
* `-e` or `--exts` to include additional extentions that you want to observe. An example being -e 'jade scss'.
* `-u` or `--usepolling` to poll for file system changes. Set this to true to successfully watch files over a network.
* `-w` or `--wait` to add a delay (in miliseconds) between when livereload detects a change to the filesystem and when it notifies the browser

@@ -132,3 +139,3 @@ Specify the path when using the options.

~~~
$ livereload . -i 200
$ livereload . -w 1000 -d
~~~

@@ -152,2 +159,3 @@

* `usePolling` Poll for file system changes. Set this to true to successfully watch files over a network.
* `delay` add a delay (in miliseconds) between when livereload detects a change to the filesystem and when it notifies the browser. Useful if the browser is reloading/refreshing before a file has been compiled, for example, by browserify.

@@ -158,4 +166,4 @@

Copyright (c) 2010-2014 Brian P. Hogan and Joshua Peek
Copyright (c) 2010-2016 Brian P. Hogan and Joshua Peek
Released under the MIT license. See `LICENSE` for details.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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