@webqit/webflo 0.11.34 → 0.11.36
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/package.json +2 -2
- package/src/config-pi/deployment/Env.js +4 -5
- package/src/config-pi/deployment/Layout.js +3 -4
- package/src/config-pi/deployment/Origins.js +7 -8
- package/src/config-pi/deployment/Virtualization.js +29 -20
- package/src/config-pi/runtime/Client.js +5 -8
- package/src/config-pi/runtime/Server.js +24 -27
- package/src/config-pi/runtime/client/Worker.js +5 -6
- package/src/config-pi/runtime/server/Headers.js +6 -9
- package/src/config-pi/runtime/server/Redirects.js +6 -10
- package/src/config-pi/static/Manifest.js +9 -11
- package/src/config-pi/static/Ssg.js +4 -6
- package/src/runtime-pi/Router.js +3 -3
- package/src/runtime-pi/Runtime.js +21 -0
- package/src/runtime-pi/RuntimeClient.js +29 -0
- package/src/runtime-pi/client/Runtime.js +30 -41
- package/src/runtime-pi/client/RuntimeClient.js +10 -13
- package/src/runtime-pi/client/Workport.js +13 -1
- package/src/runtime-pi/client/index.js +1 -3
- package/src/runtime-pi/client/worker/Worker.js +21 -36
- package/src/runtime-pi/client/worker/WorkerClient.js +8 -11
- package/src/runtime-pi/client/worker/Workport.js +11 -1
- package/src/runtime-pi/client/worker/index.js +1 -3
- package/src/runtime-pi/server/Router.js +1 -0
- package/src/runtime-pi/server/Runtime.js +259 -216
- package/src/runtime-pi/server/RuntimeClient.js +10 -7
- package/src/runtime-pi/server/index.js +1 -3
- package/src/services-pi/cert/http-auth-hook.js +1 -1
- package/src/services-pi/cert/http-cleanup-hook.js +1 -1
- package/src/webflo.js +1 -1
|
@@ -6,8 +6,9 @@ import Fs from 'fs';
|
|
|
6
6
|
import Path from 'path';
|
|
7
7
|
import QueryString from 'querystring';
|
|
8
8
|
import Router from './Router.js';
|
|
9
|
+
import _RuntimeClient from '../RuntimeClient.js';
|
|
9
10
|
|
|
10
|
-
export default class RuntimeClient {
|
|
11
|
+
export default class RuntimeClient extends _RuntimeClient {
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* RuntimeClient
|
|
@@ -15,10 +16,15 @@ export default class RuntimeClient {
|
|
|
15
16
|
* @param Context cx
|
|
16
17
|
*/
|
|
17
18
|
constructor(cx) {
|
|
18
|
-
|
|
19
|
+
super(cx);
|
|
19
20
|
this.renderFileCache = {};
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
// Returns router class
|
|
24
|
+
get Router() {
|
|
25
|
+
return Router;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* Handles navigation events.
|
|
24
30
|
*
|
|
@@ -29,23 +35,21 @@ export default class RuntimeClient {
|
|
|
29
35
|
*/
|
|
30
36
|
async handle(httpEvent, remoteFetch) {
|
|
31
37
|
// The app router
|
|
32
|
-
const router = new Router(this.cx, httpEvent.url.pathname);
|
|
38
|
+
const router = new this.Router(this.cx, httpEvent.url.pathname);
|
|
33
39
|
const handle = async () => {
|
|
34
40
|
// --------
|
|
35
41
|
// ROUTE FOR DATA
|
|
36
42
|
// --------
|
|
37
|
-
|
|
43
|
+
const httpMethodName = httpEvent.request.method.toUpperCase();
|
|
38
44
|
let response = await router.route([httpMethodName, 'default'], httpEvent, {}, async event => {
|
|
39
45
|
return router.file(event);
|
|
40
46
|
}, remoteFetch);
|
|
41
47
|
if (!(response instanceof httpEvent.Response)) {
|
|
42
48
|
response = new httpEvent.Response(response);
|
|
43
49
|
}
|
|
44
|
-
|
|
45
50
|
// --------
|
|
46
51
|
// Rendering
|
|
47
52
|
// --------
|
|
48
|
-
|
|
49
53
|
if (response.ok && response.bodyAttrs.inputType === 'object' && httpEvent.request.headers.accept.match('text/html')) {
|
|
50
54
|
let rendering = await this.render(httpEvent, router, response);
|
|
51
55
|
if (typeof rendering !== 'string' && !(typeof rendering === 'object' && rendering && typeof rendering.toString === 'function')) {
|
|
@@ -59,7 +63,6 @@ export default class RuntimeClient {
|
|
|
59
63
|
|
|
60
64
|
return response;
|
|
61
65
|
};
|
|
62
|
-
|
|
63
66
|
// --------
|
|
64
67
|
// PIPE THROUGH MIDDLEWARES
|
|
65
68
|
// --------
|
|
@@ -12,9 +12,7 @@ import Runtime from './Runtime.js';
|
|
|
12
12
|
export async function start(clientCallback = null) {
|
|
13
13
|
const cx = this || {};
|
|
14
14
|
const defaultClientCallback = _cx => new RuntimeClient(_cx);
|
|
15
|
-
return new Runtime(Context.create(cx),
|
|
16
|
-
return clientCallback ? clientCallback( ...args.concat( defaultClientCallback ) ) : defaultClientCallback( ...args );
|
|
17
|
-
});
|
|
15
|
+
return new Runtime(Context.create(cx), clientCallback || defaultClientCallback);
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
/**
|
package/src/webflo.js
CHANGED
|
@@ -21,7 +21,7 @@ const cx = WebfloPI.Context.create({
|
|
|
21
21
|
app: { title: appJson.title, version: appJson.version },
|
|
22
22
|
logger: Logger,
|
|
23
23
|
config: WebfloPI.config,
|
|
24
|
-
middlewares: [ WebfloPI.deployment.origins.webhook
|
|
24
|
+
middlewares: [ WebfloPI.deployment.origins.webhook ],
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
/**
|