live-server
Advanced tools
Comparing version 0.9.1 to 0.9.2
26
index.js
#!/usr/bin/env node | ||
var fs = require('fs'), | ||
connect = require('connect'), | ||
serveIndex = require('serve-index'), | ||
logger = require('morgan'), | ||
WebSocket = require('faye-websocket'), | ||
@@ -18,3 +20,4 @@ path = require('path'), | ||
server: null, | ||
watchers: [] | ||
watchers: [], | ||
logLevel: 2 | ||
}; | ||
@@ -58,3 +61,3 @@ | ||
} | ||
if (injectTag === null) { | ||
if (injectTag === null && LiveServer.logLevel >= 2) { | ||
console.warn("Failed to inject refresh script!".yellow, | ||
@@ -127,3 +130,3 @@ "Couldn't find any of the tags ", injectCandidates, "from", filepath); | ||
var watchPaths = options.watch || [root]; | ||
var logLevel = options.logLevel === undefined ? 2 : options.logLevel; | ||
LiveServer.logLevel = options.logLevel === undefined ? 2 : options.logLevel; | ||
var openPath = (options.open === undefined || options.open === true) ? | ||
@@ -141,5 +144,6 @@ "" : ((options.open === null || options.open === false) ? null : options.open); | ||
var mountPath = path.resolve(process.cwd(), mountRule[1]); | ||
watchPaths.push(mountPath); | ||
if (!options.watch) // Auto add mount paths to wathing but only if exclusive path option is not given | ||
watchPaths.push(mountPath); | ||
app.use(mountRule[0], staticServer(mountPath)); | ||
if (logLevel >= 1) | ||
if (LiveServer.logLevel >= 1) | ||
console.log('Mapping %s to "%s"', mountRule[0], mountPath); | ||
@@ -149,5 +153,5 @@ }); | ||
.use(entryPoint(staticServerHandler, file)) | ||
.use(connect.directory(root, { icons: true })); | ||
if (logLevel >= 2) | ||
app.use(connect.logger('dev')); | ||
.use(serveIndex(root, { icons: true })); | ||
if (LiveServer.logLevel >= 2) | ||
app.use(logger('dev')); | ||
var server = http.createServer(app); | ||
@@ -181,3 +185,3 @@ | ||
// Output | ||
if (logLevel >= 1) { | ||
if (LiveServer.logLevel >= 1) { | ||
if (serveURL === openURL) | ||
@@ -245,7 +249,7 @@ console.log(("Serving \"%s\" at %s").green, root, serveURL); | ||
ws.send('refreshcss'); | ||
if (logLevel >= 1) | ||
if (LiveServer.logLevel >= 1) | ||
console.log("CSS change detected".magenta, filePath); | ||
} else { | ||
ws.send('reload'); | ||
if (logLevel >= 1) | ||
if (LiveServer.logLevel >= 1) | ||
console.log("File change detected".cyan, filePath); | ||
@@ -252,0 +256,0 @@ } |
{ | ||
"name": "live-server", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "simple development http server with live reload capability", | ||
@@ -16,6 +16,8 @@ "keywords": [ | ||
"colors": "latest", | ||
"connect": "2.x.x", | ||
"connect": "3.4.x", | ||
"serve-index": "^1.7.2", | ||
"morgan": "^1.6.1", | ||
"event-stream": "latest", | ||
"faye-websocket": "0.9.x", | ||
"object-assign": "^2.0.0", | ||
"faye-websocket": "0.10.x", | ||
"object-assign": "latest", | ||
"opn": "latest", | ||
@@ -27,3 +29,3 @@ "send": "latest", | ||
"mocha": "^2.3.3", | ||
"supertest": "1.0.1" | ||
"supertest": "^1.0.1" | ||
}, | ||
@@ -42,3 +44,3 @@ "scripts": { | ||
"engines": { | ||
"node": ">=0.8.0" | ||
"node": ">=0.10.0" | ||
}, | ||
@@ -45,0 +47,0 @@ "preferGlobal": true, |
@@ -78,3 +78,3 @@ [![view on npm](http://img.shields.io/npm/v/live-server.svg)](https://www.npmjs.org/package/live-server) | ||
file: "index.html", // When set, serve this file for every 404 (useful for single-page applications) | ||
wait: 1000 // Waits for all changes, before reloading. Defaults to 0 sec. | ||
wait: 1000, // Waits for all changes, before reloading. Defaults to 0 sec. | ||
mount: [['/components', './node_modules']] // Mount a directory to a route. | ||
@@ -107,2 +107,6 @@ }; | ||
* v0.9.2 | ||
- Updated most dependencies to latest versions | ||
- `--quiet` now silences warning about injection failure | ||
- Giving explicit `--watch` paths now disables adding mounted paths to watching | ||
* v0.9.1 | ||
@@ -109,0 +113,0 @@ - `--ignorePattern=RGXP` exclude files from watching by regexp (@psi-4ward) |
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
29101
17
475
194
10
+ Addedmorgan@^1.6.1
+ Addedserve-index@^1.7.2
+ Addedbasic-auth@2.0.1(transitive)
+ Addedbatch@0.6.1(transitive)
+ Addedconnect@3.4.1(transitive)
+ Addedfaye-websocket@0.10.0(transitive)
+ Addedfinalhandler@0.4.1(transitive)
+ Addedhttp-errors@1.6.3(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedmorgan@1.10.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedserve-index@1.9.1(transitive)
+ Addedsetprototypeof@1.1.0(transitive)
- Removedaccepts@1.2.13(transitive)
- Removedbase64-url@1.2.1(transitive)
- Removedbasic-auth@1.0.4(transitive)
- Removedbasic-auth-connect@1.0.0(transitive)
- Removedbatch@0.5.3(transitive)
- Removedbody-parser@1.13.3(transitive)
- Removedbytes@2.1.02.4.0(transitive)
- Removedcompressible@2.0.18(transitive)
- Removedcompression@1.5.2(transitive)
- Removedconnect@2.30.2(transitive)
- Removedconnect-timeout@1.6.2(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookie@0.1.3(transitive)
- Removedcookie-parser@1.3.5(transitive)
- Removedcookie-signature@1.0.6(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcrc@3.3.0(transitive)
- Removedcsrf@3.0.6(transitive)
- Removedcsurf@1.8.3(transitive)
- Removeddepd@1.0.1(transitive)
- Removeddestroy@1.0.4(transitive)
- Removederrorhandler@1.4.3(transitive)
- Removedescape-html@1.0.2(transitive)
- Removedetag@1.7.0(transitive)
- Removedexpress-session@1.11.3(transitive)
- Removedfaye-websocket@0.9.4(transitive)
- Removedfinalhandler@0.4.0(transitive)
- Removedfresh@0.3.0(transitive)
- Removedhttp-errors@1.3.1(transitive)
- Removediconv-lite@0.4.110.4.13(transitive)
- Removedisarray@0.0.1(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmethod-override@2.3.10(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@1.3.4(transitive)
- Removedmime-db@1.53.0(transitive)
- Removedmorgan@1.6.1(transitive)
- Removedms@0.7.2(transitive)
- Removedmultiparty@3.3.2(transitive)
- Removednegotiator@0.5.3(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedpause@0.1.0(transitive)
- Removedqs@4.0.0(transitive)
- Removedrandom-bytes@1.0.0(transitive)
- Removedrange-parser@1.0.3(transitive)
- Removedraw-body@2.1.7(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedresponse-time@2.3.2(transitive)
- Removedrndm@1.2.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsend@0.13.2(transitive)
- Removedserve-favicon@2.3.2(transitive)
- Removedserve-index@1.7.3(transitive)
- Removedserve-static@1.10.3(transitive)
- Removedstatuses@1.2.1(transitive)
- Removedstream-counter@0.2.0(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedtsscmp@1.0.5(transitive)
- Removedtype-is@1.6.18(transitive)
- Removeduid-safe@2.0.02.1.4(transitive)
- Removedvary@1.0.11.1.2(transitive)
- Removedvhost@3.0.2(transitive)
Updatedconnect@3.4.x
Updatedfaye-websocket@0.10.x
Updatedobject-assign@latest