🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

livelocalhost

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

livelocalhost - npm Package Compare versions

Comparing version
1.2.6
to
1.2.7
+10
-5
livelocalhost.js

@@ -75,3 +75,3 @@ // LiveLocalhost class

// start HTTP server
http.createServer(async (req, res) => {
http.createServer({ keepAliveTimeout: 0 }, async (req, res) => {

@@ -91,6 +91,8 @@ // get requested path

const useragent = res?.req?.headers?.['user-agent']?.replace(/.+\)\s/, '') || 'unknown browser';
res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
'Connection': 'keep-alive',
});

@@ -100,6 +102,9 @@

this.#resSet.add(res);
if (this.accessLog) concol.log(styleText('yellow', `SSE connection opened: ${ useragent }`));
// close connection
res.on('close', () => {
req.on('close', () => {
this.#resSet.delete(res);
if (this.accessLog) concol.log(styleText('yellow', `SSE connection closed: ${ useragent }`));
});

@@ -176,4 +181,4 @@

'Content-Type': mimeType.get(type) || mimeType.get('error'),
'Content-Length': Buffer.byteLength(content),
'Cache-Control': 'must-revalidate, max-age=0',
'Content-Length': Buffer.byteLength(content)
});

@@ -185,3 +190,3 @@ res.write( content );

}).listen( this.serveport );
}).listen( this.serveport, '0.0.0.0' );

@@ -188,0 +193,0 @@

// live reload client-side script for livelocalhost
/* global _hotloadJS_ */
new EventSource('_reloadSSE_').addEventListener('change', e => {
const sse = new EventSource('_reloadSSE_');
sse.addEventListener('change', e => {

@@ -40,1 +41,4 @@ const

});
// stop live reload
window.addEventListener('beforeunload', () => sse.close());
{
"name": "livelocalhost",
"version": "1.2.6",
"version": "1.2.7",
"description": "localhost development server with live reloading",

@@ -5,0 +5,0 @@ "type": "module",