@haibun/web-server-express 1.1.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/server-express.js +4 -4
- package/build/server-express.js.map +1 -1
- package/build/web-server-stepper-route.test.js +10 -9
- package/build/web-server-stepper-route.test.js.map +1 -1
- package/build/web-server-stepper.d.ts +2 -2
- package/build/web-server-stepper.d.ts.map +1 -1
- package/build/web-server-stepper.js +8 -8
- package/build/web-server-stepper.js.map +1 -1
- package/build/web-server-stepper.test.js +5 -5
- package/build/web-server-stepper.test.js.map +1 -1
- package/package.json +2 -3
package/build/server-express.js
CHANGED
|
@@ -10,11 +10,11 @@ const cookie_parser_1 = __importDefault(require("cookie-parser"));
|
|
|
10
10
|
exports.DEFAULT_PORT = 8123;
|
|
11
11
|
class ServerExpress {
|
|
12
12
|
constructor(logger, base, port = exports.DEFAULT_PORT) {
|
|
13
|
-
this.app = express_1.default();
|
|
13
|
+
this.app = (0, express_1.default)();
|
|
14
14
|
this.logger = logger;
|
|
15
15
|
this.base = base;
|
|
16
16
|
this.port = port;
|
|
17
|
-
this.app.use(cookie_parser_1.default());
|
|
17
|
+
this.app.use((0, cookie_parser_1.default)());
|
|
18
18
|
}
|
|
19
19
|
async listen() {
|
|
20
20
|
if (!ServerExpress.listening) {
|
|
@@ -76,10 +76,10 @@ class ServerExpress {
|
|
|
76
76
|
catch (e) {
|
|
77
77
|
return e.message;
|
|
78
78
|
}
|
|
79
|
-
if (!fs_1.existsSync(folder)) {
|
|
79
|
+
if (!(0, fs_1.existsSync)(folder)) {
|
|
80
80
|
throw Error(`"${folder}" doesn't exist`);
|
|
81
81
|
}
|
|
82
|
-
const stat = fs_1.statSync(folder);
|
|
82
|
+
const stat = (0, fs_1.statSync)(folder);
|
|
83
83
|
if (!stat.isDirectory()) {
|
|
84
84
|
throw Error(`"${folder}" is not a directory`);
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-express.js","sourceRoot":"","sources":["../src/server-express.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA0C;AAC1C,sDAAkD;AAClD,kEAAyC;AAK5B,QAAA,YAAY,GAAG,IAAI,CAAC;AAEjC,MAAa,aAAa;IAQxB,YAAY,MAAe,EAAE,IAAY,EAAE,OAAe,oBAAY;QAJtE,QAAG,GAAG,iBAAO,
|
|
1
|
+
{"version":3,"file":"server-express.js","sourceRoot":"","sources":["../src/server-express.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA0C;AAC1C,sDAAkD;AAClD,kEAAyC;AAK5B,QAAA,YAAY,GAAG,IAAI,CAAC;AAEjC,MAAa,aAAa;IAQxB,YAAY,MAAe,EAAE,IAAY,EAAE,OAAe,oBAAY;QAJtE,QAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;QAKd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAA,uBAAY,GAAE,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;YAC5B,IAAI;gBACF,aAAa,CAAC,SAAS,GAAG,IAAI,CAAA;gBAE9B,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAElH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;aACtC;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;aAAM;YACL,IAAI,CAAC,M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QAClD,IAAI,cAAc,KAAK,IAAI,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,cAAc,uBAAuB,GAAG,EAAE,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC;SACb;aAAM,IAAI,cAAc,IAAI,cAAc,KAAK,IAAI,EAAE;YACpD,MAAM,KAAK,CAAC,gBAAgB,IAAI,OAAO,GAAG,KAAK,cAAc,sBAAsB,CAAC,CAAC;SACtF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnC,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;;AA7GH,sCA8GC;AA5GQ,uBAAS,GAAY,KAAK,CAAC;AAG3B,qBAAO,GAAgC,EAAE,CAAC"}
|
|
@@ -5,14 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const web_http_1 = __importDefault(require("@haibun/web-http/build/web-http"));
|
|
7
7
|
const util_1 = require("@haibun/core/build/lib/util");
|
|
8
|
-
const defs_1 = require("
|
|
8
|
+
const defs_1 = require("@haibun/core/build/lib/defs");
|
|
9
|
+
const defs_2 = require("./defs");
|
|
9
10
|
const web_server_stepper_1 = __importDefault(require("./web-server-stepper"));
|
|
10
|
-
const
|
|
11
|
+
const defs_3 = require("@haibun/core/build/lib/defs");
|
|
11
12
|
const lib_1 = require("@haibun/core/src/lib/test/lib");
|
|
12
13
|
const web_server_stepper_2 = __importDefault(require("./web-server-stepper"));
|
|
13
14
|
describe('route mount', () => {
|
|
14
|
-
it('mounts a route', async () => {
|
|
15
|
-
const TestRoute = class TestRoute extends
|
|
15
|
+
it.skip('mounts a route', async () => {
|
|
16
|
+
const TestRoute = class TestRoute extends defs_3.AStepper {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
18
19
|
this.steps = {
|
|
@@ -20,9 +21,9 @@ describe('route mount', () => {
|
|
|
20
21
|
gwta: 'serve test route to {loc}',
|
|
21
22
|
action: async ({ loc }) => {
|
|
22
23
|
const route = (req, res) => res.status(200).send('ok');
|
|
23
|
-
const webserver = await util_1.getFromRuntime(this.getWorld().runtime,
|
|
24
|
+
const webserver = await (0, util_1.getFromRuntime)(this.getWorld().runtime, defs_2.WEBSERVER);
|
|
24
25
|
await webserver.addRoute('get', loc, route);
|
|
25
|
-
return util_1.actionOK();
|
|
26
|
+
return (0, util_1.actionOK)();
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
};
|
|
@@ -30,10 +31,10 @@ describe('route mount', () => {
|
|
|
30
31
|
};
|
|
31
32
|
const wss = new web_server_stepper_2.default();
|
|
32
33
|
const feature = { path: '/features/test.feature', content: `serve test route to /test\nwebserver is listening\nfetch from http://localhost:8124/test is "ok"` };
|
|
33
|
-
const
|
|
34
|
-
options: {},
|
|
34
|
+
const result = await (0, lib_1.testWithDefaults)([feature], [web_server_stepper_1.default, TestRoute, web_http_1.default], {
|
|
35
|
+
options: { DEST: defs_1.DEFAULT_DEST, },
|
|
35
36
|
extraOptions: {
|
|
36
|
-
[util_1.getStepperOptionName(wss, 'PORT')]: '8124',
|
|
37
|
+
[(0, util_1.getStepperOptionName)(wss, 'PORT')]: '8124',
|
|
37
38
|
},
|
|
38
39
|
});
|
|
39
40
|
expect(result.ok).toBe(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-server-stepper-route.test.js","sourceRoot":"","sources":["../src/web-server-stepper-route.test.ts"],"names":[],"mappings":";;;;;AACA,+EAAsD;AACtD,sDAA6F;AAC7F,iCAAoE;AAEpE,8EAA0C;AAC1C,sDAA+D;AAC/D,uDAAiE;AACjE,8EAAoD;AAEpD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,gBAAgB,EAAE,KAA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,EAAE,EAAE,IAAI,EAAE,mBAAY,GAAG;YAChC,YAAY,EAAE;gBACZ,CAAC,IAAA,2BAAoB,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM;aAC5C;SACF,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TWorld, TNamed, TOptions } from '@haibun/core/build/lib/defs';
|
|
1
|
+
import { TWorld, TNamed, TOptions, AStepper } from '@haibun/core/build/lib/defs';
|
|
2
2
|
import { IWebServer } from './defs';
|
|
3
3
|
import { ServerExpress } from './server-express';
|
|
4
4
|
declare const WebServerStepper: {
|
|
@@ -16,7 +16,7 @@ declare const WebServerStepper: {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
setWorld(world: TWorld): void;
|
|
19
|
+
setWorld(world: TWorld, steppers: AStepper[]): void;
|
|
20
20
|
close(): Promise<void>;
|
|
21
21
|
steps: {
|
|
22
22
|
isListening: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-server-stepper.d.ts","sourceRoot":"","sources":["../src/web-server-stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAE,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"web-server-stepper.d.ts","sourceRoot":"","sources":["../src/web-server-stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAElG,OAAO,EAAE,UAAU,EAAc,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAE/D,QAAA,MAAM,gBAAgB;;mBACT,aAAa,GAAG,SAAS;;;;8BAKlB,MAAM;;;;;;;;;wBAIR,MAAM,YAAY,QAAQ,EAAE;;;;;;;;;;;;;kCA8BhB,MAAM;iCAOP,MAAM;;;;;;;;CAMlC,CAAC;AACF,eAAe,gBAAgB,CAAC;AAEhC,oBAAY,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC;AAChF,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,UAAU,CAAC;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
|
|
@@ -10,7 +10,7 @@ const WebServerStepper = class WebServerStepper extends defs_1.AStepper {
|
|
|
10
10
|
this.options = {
|
|
11
11
|
PORT: {
|
|
12
12
|
desc: `change web server port from ${server_express_1.DEFAULT_PORT}`,
|
|
13
|
-
parse: (port) => util_1.intOrError(port)
|
|
13
|
+
parse: (port) => (0, util_1.intOrError)(port)
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
this.steps = {
|
|
@@ -32,10 +32,10 @@ const WebServerStepper = class WebServerStepper extends defs_1.AStepper {
|
|
|
32
32
|
serveFiles: {
|
|
33
33
|
gwta: 'serve files from {loc}',
|
|
34
34
|
action: async ({ loc }) => {
|
|
35
|
-
const ws = await util_1.getFromRuntime(this.getWorld().runtime, defs_2.WEBSERVER);
|
|
35
|
+
const ws = await (0, util_1.getFromRuntime)(this.getWorld().runtime, defs_2.WEBSERVER);
|
|
36
36
|
const error = await ws.addStaticFolder(loc);
|
|
37
37
|
this.getWorld().shared.set('file_location', loc);
|
|
38
|
-
return error === undefined ? defs_1.OK : util_1.actionNotOK(error);
|
|
38
|
+
return error === undefined ? defs_1.OK : (0, util_1.actionNotOK)(error);
|
|
39
39
|
},
|
|
40
40
|
build: async ({ loc }) => {
|
|
41
41
|
this.getWorld().shared.set('file_location', loc);
|
|
@@ -44,12 +44,12 @@ const WebServerStepper = class WebServerStepper extends defs_1.AStepper {
|
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
setWorld(world) {
|
|
48
|
-
|
|
47
|
+
setWorld(world, steppers) {
|
|
48
|
+
super.setWorld(world, steppers);
|
|
49
49
|
// this.world.runtime[CHECK_LISTENER] = WebServerStepper.checkListener;
|
|
50
|
-
const port = util_1.getStepperOption(this, 'PORT',
|
|
51
|
-
this.webserver = new server_express_1.ServerExpress(
|
|
52
|
-
|
|
50
|
+
const port = parseInt((0, util_1.getStepperOption)(this, 'PORT', world.extraOptions)) || server_express_1.DEFAULT_PORT;
|
|
51
|
+
this.webserver = new server_express_1.ServerExpress(world.logger, [process.cwd(), 'files'].join('/'), port);
|
|
52
|
+
world.runtime[defs_2.WEBSERVER] = this.webserver;
|
|
53
53
|
}
|
|
54
54
|
async close() {
|
|
55
55
|
await this.webserver?.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-server-stepper.js","sourceRoot":"","sources":["../src/web-server-stepper.ts"],"names":[],"mappings":";;AAAA,sDAAkG;AAClG,sDAAwG;AACxG,iCAAgD;AAChD,qDAA+D;AAE/D,MAAM,gBAAgB,GAAG,MAAM,gBAAiB,SAAQ,eAAQ;IAAvC;;QAGvB,YAAO,GAAG;YACR,IAAI,EAAE;gBACJ,IAAI,EAAE,+BAA+B,6BAAY,EAAE;gBACnD,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,iBAAU,
|
|
1
|
+
{"version":3,"file":"web-server-stepper.js","sourceRoot":"","sources":["../src/web-server-stepper.ts"],"names":[],"mappings":";;AAAA,sDAAkG;AAClG,sDAAwG;AACxG,iCAAgD;AAChD,qDAA+D;AAE/D,MAAM,gBAAgB,GAAG,MAAM,gBAAiB,SAAQ,eAAQ;IAAvC;;QAGvB,YAAO,GAAG;YACR,IAAI,EAAE;gBACJ,IAAI,EAAE,+BAA+B,6BAAY,EAAE;gBACnD,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,iBAAU,EAAC,IAAI,CAAC;aAC1C;S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AC;IA3CC,QAAQ,CAAC,KAAa,EAAE,QAAoB;QAC1C,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAChC,uEAAuE;QACvE,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAA,uBAAgB,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,6BAAY,CAAC;QAC1F,IAAI,CAAC,SAAS,GAAG,IAAI,8BAAa,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3F,KAAK,CAAC,OAAO,CAAC,gBAAS,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;CAiCF,CAAC;AACF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -6,25 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const lib_1 = require("@haibun/core/build/lib/test/lib");
|
|
7
7
|
const web_http_1 = __importDefault(require("@haibun/web-http/build/web-http"));
|
|
8
8
|
const web_server_stepper_1 = __importDefault(require("./web-server-stepper"));
|
|
9
|
-
describe('static mount', () => {
|
|
9
|
+
describe.skip('static mount', () => {
|
|
10
10
|
it('serves files', async () => {
|
|
11
11
|
const feature = { path: '/features/test.feature', content: `serve files from test\nfetch from http://localhost:8123/testfile is "content"` };
|
|
12
|
-
const
|
|
12
|
+
const result = await (0, lib_1.testWithDefaults)([feature], [web_server_stepper_1.default, web_http_1.default]);
|
|
13
13
|
expect(result.ok).toBe(true);
|
|
14
14
|
});
|
|
15
15
|
it('restricts characters used in static mount folder name', async () => {
|
|
16
16
|
const feature = { path: '/features/test.feature', content: `serve files from l*(*$\n` };
|
|
17
|
-
const
|
|
17
|
+
const result = await (0, lib_1.testWithDefaults)([feature], [web_server_stepper_1.default]);
|
|
18
18
|
expect(result.ok).toBe(false);
|
|
19
19
|
});
|
|
20
20
|
it("doesn't re-mount same static mount", async () => {
|
|
21
21
|
const feature = { path: '/features/test.feature', content: `serve files from test\nserve files from test\n` };
|
|
22
|
-
const
|
|
22
|
+
const result = await (0, lib_1.testWithDefaults)([feature], [web_server_stepper_1.default]);
|
|
23
23
|
expect(result.ok).toBe(true);
|
|
24
24
|
});
|
|
25
25
|
it("doesn't permit different static mount", async () => {
|
|
26
26
|
const feature = { path: '/features/test.feature', content: `serve files from test\nserve files from fails\n` };
|
|
27
|
-
const
|
|
27
|
+
const result = await (0, lib_1.testWithDefaults)([feature], [web_server_stepper_1.default]);
|
|
28
28
|
expect(result.ok).toBe(false);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-server-stepper.test.js","sourceRoot":"","sources":["../src/web-server-stepper.test.ts"],"names":[],"mappings":";;;;;AAAA,yDAAmE;AACnE,+EAAsD;AAEtD,8EAA0C;AAE1C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"web-server-stepper.test.js","sourceRoot":"","sources":["../src/web-server-stepper.test.ts"],"names":[],"mappings":";;;;;AAAA,yDAAmE;AACnE,+EAAsD;AAEtD,8EAA0C;AAE1C,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QAC5B,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,+EAA+E,EAAE,CAAC;QAC7I,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAgB,EAAC,CAAC,OAAO,CAAC,EAAE,CAAC,4BAAM,EAAE,kBAAO,CAAC,CAAC,CAAC;QAEpE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC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-
"version": "1.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/web-server-stepper.js",
|
|
6
6
|
"files": [
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"eslint-plugin-prettier": "^3.3.1",
|
|
34
34
|
"jest": "^27.0.4",
|
|
35
35
|
"prettier": "^2.3.1",
|
|
36
|
-
"ts-jest": "^27.0.3",
|
|
37
36
|
"ts-node": "^10.0.0",
|
|
38
37
|
"tslint": "^6.1.3"
|
|
39
38
|
}
|
|
40
|
-
}
|
|
39
|
+
}
|