🎩 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.5
to
1.2.6
+9
-7
index.js

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

// option configuration
/* eslint-disable no-multi-spaces */
config = [

@@ -24,2 +25,3 @@ { env: null, cli: 'env', clis: 'e', prop: null, type: 'file', default: null, help: 'load defaults from an .env file' },

],
/* eslint-enable no-multi-spaces */
helpLink = styleText('cyanBright', 'For help, refer to https://www.npmjs.com/package/livelocalhost');

@@ -149,3 +151,3 @@

${ styleText(['dim','italic'], '(--save-dev ensures it\'s only available in development)') }
${ styleText(['dim', 'italic'], '(--save-dev ensures it\'s only available in development)') }

@@ -173,7 +175,7 @@ Import the module into any JavaScript file (such as index.js):

.filter(c => c.prop)
.map(c => ` ${ styleText('green', '.' + c.prop.padEnd(13, ' ')) }${ styleText('dim', (c.type ? ' = <' + c.type + '>;' : '').padEnd(17)) } ${ styleText(['green','dim'], '// ' + c.help) } ${ c.default !== null ? styleText('dim', `(${ c.type === 'path' ? '\'' : ''}${ c.default }${ c.type === 'path' ? '\'' : ''})`) : '' }`)
.map(c => ` ${ styleText('green', '.' + c.prop.padEnd(13, ' ')) }${ styleText('dim', (c.type ? ' = <' + c.type + '>;' : '').padEnd(17)) } ${ styleText(['green', 'dim'], '// ' + c.help) } ${ c.default !== null ? styleText('dim', `(${ c.type === 'path' ? '\'' : ''}${ c.default }${ c.type === 'path' ? '\'' : ''})`) : '' }`)
.join('\n')
}
${ styleText(['dim','italic'], '(If not set, options fall back to environment variables then defaults.)') }
${ styleText(['dim', 'italic'], '(If not set, options fall back to environment variables then defaults.)') }

@@ -206,6 +208,6 @@ ${ helpLink }

case 'int':
case 'num':
value = parseFloat(value.trim());
break;
case 'int':
case 'num':
value = parseFloat(value.trim());
break;

@@ -212,0 +214,0 @@ }

// LiveLocalhost class
import pkg from './package.json' with { type: 'json' };
import process from 'node:process';
import http from 'node:http';
import { isAbsolute, join, normalize, extname, sep } from 'node:path';
import { access, stat, readFile } from 'fs/promises';
import { constants as fsConstants } from 'fs';
import { watch } from 'node:fs';
import { watch, constants as fsConstants } from 'node:fs';
import { access, stat, readFile } from 'node:fs/promises';
import { styleText } from 'node:util';

@@ -23,3 +23,3 @@

hotloadJS = (process.env.HOTLOAD_JS?.toLowerCase() === 'true');
watchDebounce = parseFloat(process.env.WATCH_DEBOUNCE || 600);
watchDebounce = parseFloat(process.env.WATCH_DEBOUNCE || 600);
accessLog = (process.env.ACCESS_LOG?.toLowerCase() === 'true');

@@ -71,4 +71,4 @@

(await readFile(join(import.meta.dirname, 'livereload.js'), { encoding: 'utf8' }))
.replace('_reloadSSE_', reloadSSE)
.replace('_hotloadJS_', String( this.hotloadJS ))
.replaceAll('_reloadSSE_', reloadSSE)
.replaceAll('_hotloadJS_', String( this.hotloadJS ))
: '';

@@ -208,2 +208,3 @@

[ 'access logs', (this.accessLog ? 'enabled' : 'disabled') ],
[ 'version', pkg.version ],
'─'.repeat(50),

@@ -227,3 +228,5 @@ );

watch(this.#serverDir, { recursive: true }, (event, file) => {
changed.add(file.replaceAll(sep, '/'));
if (typeof file === 'string') {
changed.add(file.replaceAll(sep, '/'));
}
wait();

@@ -281,2 +284,3 @@ });

}
/* eslint-disable no-unused-vars,no-empty */
catch (e) {

@@ -291,2 +295,3 @@ return info;

catch (e) {}
/* eslint-enable no-unused-vars,no-empty */

@@ -293,0 +298,0 @@ return info;

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

@@ -3,0 +4,0 @@

// file mime types
/* eslint-disable no-multi-spaces,comma-spacing */
export const mimeType = new Map([

@@ -55,1 +56,2 @@ [ '.html' ,'text/html' ],

]);
/* eslint-enable no-multi-spaces,comma-spacing */
{
"name": "livelocalhost",
"version": "1.2.5",
"version": "1.2.6",
"description": "localhost development server with live reloading",

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