Comparing version 7.0.1 to 7.1.0
@@ -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); |
{ | ||
"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" | ||
} | ||
} |
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
12083
240
+ Addedserve-handler@2.3.12(transitive)
- Removedserve-handler@2.3.10(transitive)
Updatedserve-handler@2.3.12