Socket
Socket
Sign inDemoInstall

live-server

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

live-server - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

.github/CONTRIBUTING.md

19

index.js

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

* @param ignorePattern {regexp} Ignore files by RegExp
* @param noCssInject Don't inject CSS changes, just reload as with any other file change
* @param open {(string|string[])} Subpath(s) to open in browser, use false to suppress launch (default: server root)

@@ -152,3 +153,17 @@ * @param mount {array} Mount directories onto a route, e.g. [['/components', './node_modules']].

var middleware = options.middleware || [];
var noCssInject = options.noCssInject;
var httpsModule = options.httpsModule;
if (httpsModule) {
try {
require.resolve(httpsModule);
} catch (e) {
console.error(("HTTPS module \"" + httpsModule + "\" you've provided was not found.").red);
console.error("Did you do", "\"npm install " + httpsModule + "\"?");
return;
}
} else {
httpsModule = "https";
}
// Setup a web server

@@ -223,3 +238,3 @@ var app = connect();

}
server = require("https").createServer(httpsConfig, app);
server = require(httpsModule).createServer(httpsConfig, app);
protocol = "https";

@@ -349,3 +364,3 @@ } else {

function handleChange(changePath) {
var cssChange = path.extname(changePath) === ".css";
var cssChange = path.extname(changePath) === ".css" && !noCssInject;
if (LiveServer.logLevel >= 1) {

@@ -352,0 +367,0 @@ if (cssChange)

@@ -71,2 +71,6 @@ #!/usr/bin/env node

}
else if (arg === "--no-css-inject") {
opts.noCssInject = true;
process.argv.splice(i, 1);
}
else if (arg === "--no-browser") {

@@ -132,2 +136,6 @@ opts.open = false;

}
else if (arg.indexOf("--https-module=") > -1) {
opts.httpsModule = arg.substring(15);
process.argv.splice(i, 1);
}
else if (arg.indexOf("--proxy=") > -1) {

@@ -144,3 +152,3 @@ // split only on the first ":", as the URL will contain ":" as well

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] [--proxy=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] [--no-css-inject] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--https=PATH] [--https-module=MODULE_NAME] [--proxy=PATH] [PATH]');
process.exit();

@@ -147,0 +155,0 @@ }

22

package.json
{
"name": "live-server",
"version": "1.2.0",
"version": "1.2.1",
"description": "simple development http server with live reload capability",

@@ -15,10 +15,10 @@ "keywords": [

"dependencies": {
"chokidar": "^1.6.0",
"chokidar": "^2.0.4",
"colors": "latest",
"connect": "3.5.x",
"connect": "^3.6.6",
"cors": "latest",
"event-stream": "latest",
"event-stream": "3.3.4",
"faye-websocket": "0.11.x",
"http-auth": "3.1.x",
"morgan": "^1.6.1",
"morgan": "^1.9.1",
"object-assign": "latest",

@@ -28,9 +28,9 @@ "opn": "latest",

"send": "latest",
"serve-index": "^1.7.2"
"serve-index": "^1.9.1"
},
"devDependencies": {
"mocha": "^3.2.0",
"supertest": "^2.0.1",
"eslint": "^3.13.0",
"jshint": "^2.9.2"
"eslint": "^5.9.0",
"jshint": "^2.9.6",
"mocha": "^5.2.0",
"supertest": "^3.3.0"
},

@@ -40,3 +40,3 @@ "scripts": {

"hint": "jshint live-server.js index.js",
"test": "mocha test && npm run lint"
"test": "mocha test --exit && npm run lint"
},

@@ -43,0 +43,0 @@ "bin": {

@@ -56,2 +56,3 @@ [![view on npm](http://img.shields.io/npm/v/live-server.svg)](https://www.npmjs.org/package/live-server)

* `--ignorePattern=RGXP` - Regular expression of files to ignore (ie `.*\.jade`) (**DEPRECATED** in favor of `--ignore`)
* `--no-css-inject` - reload page on CSS change, rather than injecting changed CSS
* `--middleware=PATH` - path to .js file exporting a middleware function to add; can be a name without path nor extension to reference bundled middlewares in `middleware` folder

@@ -65,2 +66,3 @@ * `--entry-file=PATH` - serve this file (server root relative) in place of missing files (useful for single page apps)

* `--https=PATH` - PATH to a HTTPS configuration module
* `--https-module=MODULE_NAME` - Custom HTTPS module (e.g. `spdy`)
* `--proxy=ROUTE:URL` - proxy all requests for ROUTE to URL

@@ -87,3 +89,3 @@ * `--help | -h` - display terse usage hint and exit

ignore: 'scss,my/templates', // comma-separated string for paths to ignore
file: "index.html", // When set, serve this file for every 404 (useful for single-page applications)
file: "index.html", // When set, serve this file (server root relative) for every 404 (useful for single-page applications)
wait: 1000, // Waits for all changes, before reloading. Defaults to 0 sec.

@@ -117,3 +119,15 @@ mount: [['/components', './node_modules']], // Mount a directory to a route.

HTTP/2
---------------
To get HTTP/2 support one can provide a custom HTTPS module via `--https-module` CLI parameter (`httpsModule` option for Node.js script). **Be sure to install the module first.**
HTTP/2 unencrypted mode is not supported by browsers, thus not supported by `live-server`. See [this question](https://http2.github.io/faq/#does-http2-require-encryption) and [can I use page on HTTP/2](http://caniuse.com/#search=http2) for more details.
For example from CLI(bash):
live-server \
--https=path/to/https.conf.js \
--https-module=spdy \
my-app-folder/
Troubleshooting

@@ -138,3 +152,3 @@ ---------------

We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
We welcome contributions! See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details.

@@ -145,2 +159,6 @@

* v1.2.1
- `--https-module=MODULE_NAME` to specify custom HTTPS module (e.g. `spdy`) (@pavel)
- `--no-css-inject` to reload page on css change instead of injecting the changes (@kylecordes)
- Dependencies updated to get rid of vulnerabilities in deps
* v1.2.0

@@ -147,0 +165,0 @@ - Add `--middleware` parameter to use external middlewares

@@ -20,3 +20,3 @@ var assert = require('assert');

assert(!error, error);
assert(stdout.indexOf("live-server") == 0, "version not found");
assert(stdout.indexOf("live-server") === 0, "version not found");
done();

@@ -28,3 +28,3 @@ });

assert(!error, error);
assert(stdout.indexOf("Usage: live-server") == 0, "usage not found");
assert(stdout.indexOf("Usage: live-server") === 0, "usage not found");
done();

@@ -43,3 +43,3 @@ });

assert(!error, error);
assert(stdout.indexOf("Serving") == 0, "serving string not found");
assert(stdout.indexOf("Serving") >= 0, "serving string not found");
assert(stdout.indexOf("at http://127.0.0.1:16123") != -1, "port string not found");

@@ -52,3 +52,3 @@ done();

assert(!error, error);
assert(stdout.indexOf("Serving") == 0, "serving string not found");
assert(stdout.indexOf("Serving") >= 0, "serving string not found");
assert(stdout.indexOf("at http://localhost:") != -1, "host string not found");

@@ -65,3 +65,3 @@ done();

assert(!error, error);
assert(stdout.indexOf("Serving") == 0, "serving string not found");
assert(stdout.indexOf("Serving") >= 0, "serving string not found");
done();

@@ -68,0 +68,0 @@ });

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