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

lws

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lws - npm Package Compare versions

Comparing version 2.0.0-6 to 2.0.0-7

50

index.js

@@ -31,2 +31,3 @@ const util = require('./lib/util')

* @param [options.modulePrefix] {string} - An optional string to prefix to module names when loading middleware modules Defaults to 'lws-'.
* @param [options.view] {object} - View instance.
* @returns {Server}

@@ -55,2 +56,3 @@ */

this.setConfig(config)
this.setStack()
}

@@ -83,2 +85,25 @@

/**
* Sets the middleware stack, loading plugins if supplied.
*/
setStack () {
const arrayify = require('array-back')
const Stack = require('./lib/middleware-stack')
let stack = arrayify(this.config.stack).slice()
/* convert stack to type MiddlewareStack */
if (!(stack instanceof Stack)) {
stack = Stack.from(stack, {
paths: this.config.moduleDir,
prefix: this.config.modulePrefix
})
}
util.propagate('verbose', stack, this)
this.stack = stack
}
/**
* Create a HTTP, HTTPS or HTTP2 server, depending on config. Returns the output of Node's standard http, https or http2 `.createServer()` method.
* @returns {Server}
*/
createServer () {

@@ -141,23 +166,4 @@ if (this.server) throw new Error('server already created')

/**
*
*/
loadMiddlewareStack () {
const arrayify = require('array-back')
let stack = arrayify(this.config.stack).slice()
/* validate stack */
const Stack = require('./lib/middleware-stack')
if (!(stack instanceof Stack)) {
stack = Stack.from(stack, {
paths: this.config.moduleDir,
prefix: this.config.modulePrefix
})
}
this.stack = stack
}
/* Pipe server events into 'verbose' event stream */
_createServerEventStream () {
_propagateServerEvents () {
const write = (name, value) => {

@@ -261,6 +267,4 @@ return () => {

/* stream server events to a verbose event */
lws._createServerEventStream()
lws._propagateServerEvents()
lws.loadMiddlewareStack()
/* attach middleware */

@@ -267,0 +271,0 @@ lws.useMiddlewareStack()

@@ -52,3 +52,8 @@ const flatten = require('reduce-flatten')

for (const MiddlewareClass of MiddlewareClasses) {
stack.push(new MiddlewareClass())
const middleware = new MiddlewareClass()
stack.push(middleware)
/* extending EventEmitter is optional */
if (middleware.on) {
middleware.on('verbose', (key, value) => stack.emit('verbose', key, value))
}
}

@@ -55,0 +60,0 @@ return stack

{
"name": "lws",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "2.0.0-6",
"version": "2.0.0-7",
"description": "The modular web server for productive full-stack development",

@@ -6,0 +6,0 @@ "repository": "https://github.com/lwsjs/lws.git",

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