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 0.2.0 to 0.3.0

15

live-server.js

@@ -21,7 +21,7 @@ #!/usr/bin/env node

.replace(/"/g, '"');
};
}
// Based on connect.static(), but streamlined and with added code injecter
function static(root) {
return function static(req, res, next) {
function staticServer(root) {
return function(req, res, next) {
if ('GET' != req.method && 'HEAD' != req.method) return next();

@@ -44,3 +44,3 @@ var reqpath = url.parse(req.url).pathname;

var x = path.extname(reqpath);
if (x == "" || x == ".html" || x == ".htm" || x == ".xhtml" || x == ".php") {
if (x === "" || x == ".html" || x == ".htm" || x == ".xhtml" || x == ".php") {
// We need to modify the length given to browser

@@ -61,3 +61,3 @@ var len = INJECTED_CODE.length + res.getHeader('Content-Length');

};
};
}

@@ -69,3 +69,4 @@ function start(port, directory) {

var app = connect()
.use(static(directory)) // Custom static server
.use(staticServer(directory)) // Custom static server
.use(connect.directory(directory, { icons: true }))
.use(connect.logger('dev'));

@@ -76,3 +77,3 @@ var server = http.createServer(app).listen(port);

ws = new WebSocket(request, socket, head);
ws.onopen = function() { ws.send('connected'); }
ws.onopen = function() { ws.send('connected'); };
});

@@ -79,0 +80,0 @@ // Setup file watcher

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

@@ -22,2 +22,5 @@ "keywords": [

},
"scripts": {
"test": "jshint *.js"
},
"bin": {

@@ -24,0 +27,0 @@ "live-server": "./live-server.js"

@@ -55,2 +55,16 @@ Live Server

Version history
---------------
* v0.3.0
- Directory listings
* v0.2.0
- On-the-fly CSS refresh (no page reload)
- Refactoring
* v0.1.1
- Documentation and meta tweaks
* v0.1.0
- Initial release
License

@@ -57,0 +71,0 @@ -------

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