Socket
Socket
Sign inDemoInstall

live-server

Package Overview
Dependencies
75
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

.travis.yml

16

index.js

@@ -75,3 +75,3 @@ #!/usr/bin/env node

}
if (injectTag === null && LiveServer.logLevel >= 2) {
if (injectTag === null && LiveServer.logLevel >= 3) {
console.warn("Failed to inject refresh script!".yellow,

@@ -137,2 +137,3 @@ "Couldn't find any of the tags ", injectCandidates, "from", filepath);

* @param htpasswd {string} Path to htpasswd file to enable HTTP Basic authentication
* @param middleware {array} Append middleware to stack, e.g. [function(req, res, next) { next(); }].
*/

@@ -158,2 +159,4 @@ LiveServer.start = function(options) {

var https = options.https || null;
var proxy = options.proxy || [];
var middleware = options.middleware || [];

@@ -163,2 +166,5 @@ // Setup a web server

// Add middleware
middleware.map(app.use.bind(app));
// Use http-auth if configured

@@ -187,2 +193,10 @@ if (htpasswd !== null) {

});
proxy.forEach(function(proxyRule) {
var proxyOpts = url.parse(proxyRule[1]);
proxyOpts.via = true;
proxyOpts.preserveHost = true;
app.use(proxyRule[0], require('proxy-middleware')(proxyOpts));
if (LiveServer.logLevel >= 1)
console.log('Mapping %s to "%s"', proxyRule[0], proxyRule[1]);
});
app.use(staticServerHandler) // Custom static server

@@ -189,0 +203,0 @@ .use(entryPoint(staticServerHandler, file))

13

live-server.js

@@ -12,2 +12,3 @@ #!/usr/bin/env node

mount: [],
proxy: [],
logLevel: 2

@@ -29,3 +30,3 @@ };

var portNumber = parseInt(portString, 10);
if (portNumber == portString) {
if (portNumber === +portString) {
opts.port = portNumber;

@@ -94,3 +95,3 @@ process.argv.splice(i, 1);

var waitNumber = parseInt(waitString, 10);
if (waitNumber == waitString) {
if (waitNumber === +waitString) {
opts.wait = waitNumber;

@@ -117,4 +118,10 @@ process.argv.splice(i, 1);

}
else if (arg.indexOf("--proxy=") > -1) {
// split only on the first ":", as the URL will contain ":" as well
var match = arg.substring(8).match(/([^:]+):(.+)$/);
opts.proxy.push([ match[1], match[2] ]);
process.argv.splice(i, 1);
}
else if (arg === "--help" || arg === "-h") {
console.log('Usage: live-server [-v|--version] [-h|--help] [-q|--quiet] [--port=PORT] [--host=HOST] [--open=PATH] [--no-browser] [--browser=BROWSER] [--ignore=PATH] [--ignorePattern=RGXP] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--https=PATH] [PATH]');
console.log('Usage: live-server [-v|--version] [-h|--help] [-q|--quiet] [--port=PORT] [--host=HOST] [--open=PATH] [--no-browser] [--browser=BROWSER] [--ignore=PATH] [--ignorePattern=RGXP] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--https=PATH] [--proxy=PATH] [PATH]');
process.exit();

@@ -121,0 +128,0 @@ }

{
"name": "live-server",
"version": "1.0.0",
"version": "1.1.0",
"description": "simple development http server with live reload capability",

@@ -19,10 +19,11 @@ "keywords": [

"event-stream": "latest",
"faye-websocket": "0.10.x",
"http-auth": "2.2.x",
"faye-websocket": "0.11.x",
"http-auth": "2.4.x",
"morgan": "^1.6.1",
"object-assign": "latest",
"opn": "latest",
"proxy-middleware": "latest",
"send": "latest",
"serve-index": "^1.7.2",
"watchr": "2.3.x"
"watchr": "2.6.x"
},

@@ -29,0 +30,0 @@ "devDependencies": {

[![view on npm](http://img.shields.io/npm/v/live-server.svg)](https://www.npmjs.org/package/live-server)
[![npm module downloads per month](http://img.shields.io/npm/dm/live-server.svg)](https://www.npmjs.org/package/live-server)
[![build status](https://travis-ci.org/tapio/live-server.svg)](https://travis-ci.org/tapio/live-server)

@@ -61,2 +62,3 @@ Live Server

* `--https=PATH` - PATH to a HTTPS configuration module
* `--proxy=ROUTE:URL` - proxy all requests for ROUTE to URL
* `--help | -h` - display terse usage hint and exit

@@ -85,3 +87,4 @@ * `--version | -v` - display version and exit

mount: [['/components', './node_modules']], // Mount a directory to a route.
logLevel: 2 // 0 = errors only, 1 = some, 2 = lots
logLevel: 2, // 0 = errors only, 1 = some, 2 = lots
middleware: [function(req, res, next) { next(); }] // Takes an array of Connect-compatible middleware that are injected into the server middleware stack
};

@@ -130,2 +133,7 @@ liveServer.start(params);

* v1.1.0
- Proxy support (@pavel)
- Middleware support (@achandrasekar)
- Dependency updates (@tapio, @rahatarmanahmed)
- Using Travis CI
* v1.0.0

@@ -132,0 +140,0 @@ - HTTPS support (@pavel)

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc