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

@eonasdan/parvus-server

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eonasdan/parvus-server - npm Package Compare versions

Comparing version 1.1.9 to 1.2.0

13

dist/server.js

@@ -63,2 +63,3 @@ 'use strict';

config.middlewares?.forEach(x => this.addMiddleware(x.middleware, x.route));
this.mimeTypes = config.additionalMimeTypes || [];
}

@@ -68,3 +69,4 @@ }

async startAsync() {
this.mimeTypes = await ParvusServer.fetchMimetypes();
const mimeTypes = await ParvusServer.fetchMimetypes();
this.mimeTypes = this.mergedMimeTypes(mimeTypes);
this.createServer();

@@ -94,2 +96,11 @@ }

}
mergedMimeTypes(mimeTypes) {
return mimeTypes.map(item1 => {
const item2 = this.mimeTypes.find(item => item.type === item1.type);
if (item2) {
return { ...item1, extensions: [...item1.extensions, ...item2.extensions] };
}
return item1;
});
}
static async fetchMimetypes() {

@@ -96,0 +107,0 @@ const file = await fs.promises.readFile(`${__dirname}/mime-types.json`, 'utf8');

8

package.json
{
"name": "@eonasdan/parvus-server",
"version": "1.1.9",
"version": "1.2.0",
"description": "",

@@ -8,7 +8,7 @@ "main": "dist/server.js",

"scripts": {
"build": "npm run rollup",
"build": "npm run rollup && node copyToDist.js",
"build:declarations": "tsc --declaration --emitDeclarationOnly --outDir types",
"start": "node example/startup.js",
"start": "npm run build && node example/startup.js",
"rollup": "rollup -c ./rollup.config.js",
"release": "npm run build && npm run build:declarations && node copyToDist.js"
"release": "npm run build && npm run build:declarations"
},

@@ -15,0 +15,0 @@ "files": [

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

import ParvusServer from './parvus-server';
import { ParvusServer, Config } from './parvus-server';
import { Next, Stack, Middleware } from './middleware';
import Config from './config';
export { ParvusServer, Next, Stack, Middleware, Config };
/// <reference types="node" />
import { Server, IncomingMessage, ServerResponse } from 'http';
import { Server as Socket } from 'socket.io';
import { Middleware } from './middleware';
import Config from './config';
export default class ParvusServer {
import { Middleware, Stack } from './middleware';
export interface MimeType {
type: string;
name: string;
extensions: string[];
}
export interface Config {
host?: string;
port?: number;
subfolder?: string;
middlewares?: Stack[];
directory?: string;
additionalMimeTypes?: MimeType[];
}
export declare class ParvusServer {
server: Server;
mimeTypes: {
type: string;
name: string;
extensions: string[];
}[];
mimeTypes: MimeType[];
io: Socket;

@@ -25,2 +33,3 @@ private connectedBefore;

addMiddleware(middleware: Middleware, route?: string): void;
private mergedMimeTypes;
private static fetchMimetypes;

@@ -27,0 +36,0 @@ private createServer;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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