Socket
Socket
Sign inDemoInstall

serve

Package Overview
Dependencies
Maintainers
4
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serve - npm Package Compare versions

Comparing version 7.0.1 to 7.1.0

26

bin/serve.js

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

const {promisify} = require('util');
const {URL} = require('url');

@@ -73,2 +74,4 @@ // Packages

-s, --single Rewrite all not-found requests to \`index.html\`
{bold ENDPOINTS}

@@ -79,2 +82,6 @@

For TCP ports on hostname "localhost":
{bold $} {cyan serve} -l {underline 1234}
For TCP (traditional host/port) endpoints:

@@ -94,2 +101,6 @@

const parseEndpoint = str => {
if (!isNaN(str)) {
return [str];
}
const url = new URL(str);

@@ -243,2 +254,3 @@

'--listen': [parseEndpoint],
'--single': Boolean,
'--debug': Boolean,

@@ -248,3 +260,4 @@ '-h': '--help',

'-l': '--listen',
'-d': '--debug'
'-d': '--debug',
'-s': '--single'
});

@@ -283,2 +296,13 @@ } catch (err) {

if (args['--single']) {
const {rewrites} = config;
const existingRewrites = Array.isArray(rewrites) ? rewrites : [];
// As the first rewrite rule, make `--single` work
config.rewrites = [{
source: '**',
destination: '/index.html'
}, ...existingRewrites];
}
for (const endpoint of args['--listen']) {

@@ -285,0 +309,0 @@ startEndpoint(endpoint, config);

4

package.json
{
"name": "serve",
"version": "7.0.1",
"version": "7.1.0",
"description": "Static file serving and directory listing",

@@ -43,5 +43,5 @@ "scripts": {

"chalk": "2.4.1",
"serve-handler": "2.3.10",
"serve-handler": "2.3.12",
"update-check": "1.5.2"
}
}
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