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

@haibun/web-server-express

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@haibun/web-server-express - npm Package Compare versions

Comparing version 1.9.0 to 1.9.1

17

build/web-server-stepper.d.ts

@@ -1,2 +0,3 @@

import { TWorld, TNamed, TOptions, AStepper } from '@haibun/core/build/lib/defs';
import { TWorld, TNamed, TOptions, AStepper, TVStep } from '@haibun/core/build/lib/defs';
import { WorkspaceContext } from '@haibun/core/src/lib/contexts';
import { IWebServer } from './defs';

@@ -22,2 +23,15 @@ import { ServerExpress } from './server-express';

steps: {
thisURI: {
gwta: string;
action: ({ where }: TNamed, vstep: TVStep) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult>;
};
webpage: {
gwta: string;
action: ({ name, location }: TNamed, vsteps: TVStep) => Promise<import("@haibun/core/build/lib/defs").TOKActionResult>;
build: ({ location }: TNamed, { source }: TVStep, workspace: WorkspaceContext) => Promise<{
finalize: (workspace: WorkspaceContext) => void;
ok: true;
topics?: import("@haibun/core/build/lib/defs").TActionResultTopics | undefined;
}>;
};
isListening: {

@@ -37,2 +51,3 @@ gwta: string;

};
finalize: (workspace: WorkspaceContext) => void;
world?: TWorld | undefined;

@@ -39,0 +54,0 @@ endFeature?(): void;

@@ -7,2 +7,5 @@ "use strict";

const server_express_1 = require("./server-express");
const WebPageBuilder_1 = require("@haibun/domain-webpage/build/WebPageBuilder");
const domain_webpage_1 = require("@haibun/domain-webpage/build/domain-webpage");
const domain_1 = require("@haibun/core/src/lib/domain");
const WebServerStepper = class WebServerStepper extends defs_1.AStepper {

@@ -18,2 +21,34 @@ constructor() {

this.steps = {
thisURI: {
gwta: `a ${domain_webpage_1.WEB_PAGE} at {where}`,
action: async ({ where }, vstep) => {
const page = vstep.source.name;
const webserver = (0, util_1.getFromRuntime)(this.getWorld().runtime, defs_2.WEBSERVER);
webserver.addStaticFolder(page);
console.debug('added page', page);
return defs_1.OK;
},
},
/// generator
webpage: {
gwta: `A ${domain_webpage_1.WEB_PAGE} {name} hosted at {location}`,
action: async ({ name, location }, vsteps) => {
const page = vsteps.source.name;
const webserver = (0, util_1.getFromRuntime)(this.getWorld().runtime, defs_2.WEBSERVER);
// TODO mount the page
return defs_1.OK;
},
build: async ({ location }, { source }, workspace) => {
if (location !== location.replace(/[^a-zA-Z-0-9\.]/g, '')) {
throw Error(`${domain_webpage_1.WEB_PAGE} location ${location} has millegal characters`);
}
const subdir = this.getWorld().shared.get('file_location');
if (!subdir) {
throw Error(`must declare a file_location`);
}
const folder = `files/${subdir}`;
workspace.addBuilder(new WebPageBuilder_1.WebPageBuilder(source.name, this.getWorld().logger, location, folder));
return { ...defs_1.OK, finalize: this.finalize };
},
},
isListening: {

@@ -48,2 +83,14 @@ gwta: 'webserver is listening',

};
this.finalize = (workspace) => {
if (workspace.get('_finalized')) {
return;
}
workspace.set('_finalized', true);
const builder = workspace.getBuilder();
const shared = builder.finalize();
const domain = (0, domain_1.getDomain)(domain_webpage_1.WEB_PAGE, this.getWorld()).shared.get(builder.name);
for (const [name, val] of shared) {
domain.set(name, val);
}
};
}

@@ -50,0 +97,0 @@ setWorld(world, steppers) {

2

package.json
{
"name": "@haibun/web-server-express",
"version": "1.9.0",
"version": "1.9.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "build/web-server-stepper.js",

Sorry, the diff of this file is not supported yet

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