Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serve

Package Overview
Dependencies
Maintainers
4
Versions
153
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 10.0.2 to 10.1.0

33

bin/serve.js

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

const boxen = require('boxen');
const compression = require('compression');

@@ -28,2 +29,3 @@ // Utilities

const lookup = promisify(dns.lookup);
const compressionHandler = promisify(compression());

@@ -157,8 +159,21 @@ const warning = (message) => chalk`{yellow WARNING:} ${message}`;

const startEndpoint = (endpoint, config, args) => {
const server = http.createServer((request, response) => handler(request, response, config));
const startEndpoint = (endpoint, config, args, previous) => {
const {isTTY} = process.stdout;
const clipboard = args['--no-clipboard'] !== true;
const compress = args['--no-compression'] !== true;
const server = http.createServer(async (request, response) => {
if (compress) {
await compressionHandler(request, response);
}
return handler(request, response, config);
});
server.on('error', (err) => {
if (err.code === 'EADDRINUSE' && endpoint.length === 1 && !isNaN(endpoint[0])) {
startEndpoint([0], config, args, endpoint[0]);
return;
}
console.error(error(`Failed to serve: ${err.stack}`));

@@ -203,2 +218,6 @@ process.exit(1);

if (previous) {
message += chalk.red(`\n\nThis port was picked because ${chalk.underline(previous)} is in use.`);
}
if (clipboard) {

@@ -281,2 +300,6 @@ try {

if (file === 'now.json' || file === 'package.json') {
console.error(warning('The config files `now.json` and `package.json` are deprecated. Please use `serve.json`.'));
}
break;

@@ -318,2 +341,3 @@ }

'--no-clipboard': Boolean,
'--no-compression': Boolean,
'-h': '--help',

@@ -326,2 +350,3 @@ '-v': '--version',

'-n': '--no-clipboard',
'-u': '--no-compression',
// This is deprecated and only for backwards-compatibility.

@@ -335,3 +360,5 @@ '-p': '--listen'

await updateCheck(args['--debug']);
if (process.env.NO_UPDATE_CHECK !== '1') {
await updateCheck(args['--debug']);
}

@@ -338,0 +365,0 @@ if (args['--version']) {

5

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

@@ -45,5 +45,6 @@ "scripts": {

"clipboardy": "1.2.3",
"serve-handler": "5.0.3",
"compression": "1.7.3",
"serve-handler": "5.0.6",
"update-check": "1.5.2"
}
}

@@ -39,3 +39,3 @@ ![](https://assets.zeit.co/image/upload/v1527770721/repositories/serve/serve-repo-banner.png)

To customize `serve`'s behavior, create a `serve.json` file and insert any of [these properties](https://github.com/zeit/serve-handler#options). In addition, `serve` will also detect `now.json` files if they contain the `static` property.
To customize `serve`'s behavior, create a `serve.json` file and insert any of [these properties](https://github.com/zeit/serve-handler#options).

@@ -42,0 +42,0 @@ ## API

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