Comparing version 10.1.1 to 10.1.2
@@ -9,3 +9,2 @@ #!/usr/bin/env node | ||
const {parse} = require('url'); | ||
const dns = require('dns'); | ||
const os = require('os'); | ||
@@ -28,5 +27,6 @@ | ||
const readFile = promisify(fs.readFile); | ||
const lookup = promisify(dns.lookup); | ||
const compressionHandler = promisify(compression()); | ||
const interfaces = os.networkInterfaces(); | ||
const warning = (message) => chalk`{yellow WARNING:} ${message}`; | ||
@@ -159,2 +159,13 @@ const info = (message) => chalk`{magenta INFO:} ${message}`; | ||
const getNetworkAddress = () => { | ||
for (const name of Object.keys(interfaces)) { | ||
for (const interface of interfaces[name]) { | ||
const {address, family, internal} = interface; | ||
if (family === 'IPv4' && !internal) { | ||
return address; | ||
} | ||
} | ||
} | ||
}; | ||
const startEndpoint = (endpoint, config, args, previous) => { | ||
@@ -194,10 +205,6 @@ const {isTTY} = process.stdout; | ||
const address = details.address === '::' ? 'localhost' : details.address; | ||
const ip = getNetworkAddress(); | ||
localAddress = `http://${address}:${details.port}`; | ||
try { | ||
const {address: ip} = await lookup(os.hostname()); | ||
networkAddress = `http://${ip}:${details.port}`; | ||
} catch (err) { | ||
console.error(error(`DNS lookup failed: ${err.message}`)); | ||
} | ||
networkAddress = `http://${ip}:${details.port}`; | ||
} | ||
@@ -204,0 +211,0 @@ |
{ | ||
"name": "serve", | ||
"version": "10.1.1", | ||
"version": "10.1.2", | ||
"description": "Static file serving and directory listing", | ||
@@ -46,5 +46,5 @@ "scripts": { | ||
"compression": "1.7.3", | ||
"serve-handler": "5.0.7", | ||
"serve-handler": "5.0.8", | ||
"update-check": "1.5.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
15685
321
1
+ Addedserve-handler@5.0.8(transitive)
- Removedserve-handler@5.0.7(transitive)
Updatedserve-handler@5.0.8