@webqit/webflo 0.11.61-0 → 1.0.0

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.
Files changed (118) hide show
  1. package/.gitignore +7 -7
  2. package/LICENSE +20 -20
  3. package/README.md +2079 -2074
  4. package/docker/Dockerfile +42 -42
  5. package/docker/README.md +91 -91
  6. package/docker/package.json +2 -2
  7. package/package.json +80 -81
  8. package/src/{Context.js → AbstractContext.js} +71 -79
  9. package/src/config-pi/deployment/Env.js +68 -68
  10. package/src/config-pi/deployment/Layout.js +63 -63
  11. package/src/config-pi/deployment/Origins.js +139 -139
  12. package/src/config-pi/deployment/Proxy.js +74 -74
  13. package/src/config-pi/deployment/index.js +17 -17
  14. package/src/config-pi/index.js +15 -15
  15. package/src/config-pi/runtime/Client.js +116 -98
  16. package/src/config-pi/runtime/Server.js +125 -125
  17. package/src/config-pi/runtime/client/Worker.js +109 -134
  18. package/src/config-pi/runtime/client/index.js +11 -11
  19. package/src/config-pi/runtime/index.js +17 -17
  20. package/src/config-pi/runtime/server/Headers.js +74 -74
  21. package/src/config-pi/runtime/server/Redirects.js +69 -69
  22. package/src/config-pi/runtime/server/index.js +13 -13
  23. package/src/config-pi/static/Manifest.js +319 -319
  24. package/src/config-pi/static/Ssg.js +49 -49
  25. package/src/config-pi/static/index.js +13 -13
  26. package/src/deployment-pi/index.js +10 -10
  27. package/src/deployment-pi/origins/index.js +216 -216
  28. package/src/index.js +11 -19
  29. package/src/runtime-pi/HttpEvent.js +126 -106
  30. package/src/runtime-pi/HttpUser.js +126 -0
  31. package/src/runtime-pi/MessagingOverBroadcast.js +9 -0
  32. package/src/runtime-pi/MessagingOverChannel.js +85 -0
  33. package/src/runtime-pi/MessagingOverSocket.js +106 -0
  34. package/src/runtime-pi/MultiportMessagingAPI.js +81 -0
  35. package/src/runtime-pi/WebfloCookieStorage.js +27 -0
  36. package/src/runtime-pi/WebfloEventTarget.js +39 -0
  37. package/src/runtime-pi/WebfloMessageEvent.js +58 -0
  38. package/src/runtime-pi/WebfloMessagingAPI.js +69 -0
  39. package/src/runtime-pi/{Router.js → WebfloRouter.js} +99 -130
  40. package/src/runtime-pi/WebfloRuntime.js +52 -0
  41. package/src/runtime-pi/WebfloStorage.js +109 -0
  42. package/src/runtime-pi/client/ClientMessaging.js +5 -0
  43. package/src/runtime-pi/client/Context.js +3 -7
  44. package/src/runtime-pi/client/CookieStorage.js +17 -0
  45. package/src/runtime-pi/client/Router.js +38 -48
  46. package/src/runtime-pi/client/SessionStorage.js +33 -0
  47. package/src/runtime-pi/client/Url.js +156 -205
  48. package/src/runtime-pi/client/WebfloClient.js +544 -0
  49. package/src/runtime-pi/client/WebfloRootClient1.js +179 -0
  50. package/src/runtime-pi/client/WebfloRootClient2.js +109 -0
  51. package/src/runtime-pi/client/WebfloSubClient.js +165 -0
  52. package/src/runtime-pi/client/Workport.js +118 -178
  53. package/src/runtime-pi/client/generate.js +480 -471
  54. package/src/runtime-pi/client/index.js +16 -21
  55. package/src/runtime-pi/client/worker/ClientMessaging.js +5 -0
  56. package/src/runtime-pi/client/worker/Context.js +3 -7
  57. package/src/runtime-pi/client/worker/CookieStorage.js +17 -0
  58. package/src/runtime-pi/client/worker/SessionStorage.js +13 -0
  59. package/src/runtime-pi/client/worker/WebfloWorker.js +294 -0
  60. package/src/runtime-pi/client/worker/Workport.js +17 -85
  61. package/src/runtime-pi/client/worker/index.js +10 -21
  62. package/src/runtime-pi/index.js +6 -13
  63. package/src/runtime-pi/server/ClientMessaging.js +18 -0
  64. package/src/runtime-pi/server/ClientMessagingRegistry.js +57 -0
  65. package/src/runtime-pi/server/Context.js +11 -15
  66. package/src/runtime-pi/server/CookieStorage.js +17 -0
  67. package/src/runtime-pi/server/Router.js +93 -159
  68. package/src/runtime-pi/server/SessionStorage.js +53 -0
  69. package/src/runtime-pi/server/WebfloServer.js +755 -0
  70. package/src/runtime-pi/server/index.js +10 -21
  71. package/src/runtime-pi/util-http.js +322 -86
  72. package/src/runtime-pi/util-url.js +146 -146
  73. package/src/runtime-pi/xURL.js +108 -105
  74. package/src/runtime-pi/xfetch.js +22 -22
  75. package/src/services-pi/cert/http-auth-hook.js +22 -22
  76. package/src/services-pi/cert/http-cleanup-hook.js +22 -22
  77. package/src/services-pi/cert/index.js +79 -79
  78. package/src/services-pi/index.js +8 -8
  79. package/src/static-pi/index.js +10 -10
  80. package/src/webflo.js +30 -30
  81. package/test/index.test.js +26 -26
  82. package/test/site/package.json +9 -9
  83. package/test/site/public/bundle.html +5 -5
  84. package/test/site/public/bundle.html.json +3 -3
  85. package/test/site/public/bundle.js +2 -2
  86. package/test/site/public/bundle.webflo.js +15 -15
  87. package/test/site/public/index.html +29 -29
  88. package/test/site/public/index1.html +34 -34
  89. package/test/site/public/page-2/bundle.html +4 -4
  90. package/test/site/public/page-2/bundle.js +2 -2
  91. package/test/site/public/page-2/index.html +45 -45
  92. package/test/site/public/page-2/main.html +2 -2
  93. package/test/site/public/page-4/subpage/bundle.js +2 -2
  94. package/test/site/public/page-4/subpage/index.html +30 -30
  95. package/test/site/public/sparoots.json +4 -4
  96. package/test/site/public/worker.js +3 -3
  97. package/test/site/server/index.js +15 -15
  98. package/src/runtime-pi/Application.js +0 -29
  99. package/src/runtime-pi/Cookies.js +0 -82
  100. package/src/runtime-pi/Runtime.js +0 -21
  101. package/src/runtime-pi/client/Application.js +0 -100
  102. package/src/runtime-pi/client/Runtime.js +0 -332
  103. package/src/runtime-pi/client/createStorage.js +0 -57
  104. package/src/runtime-pi/client/oohtml/full.js +0 -7
  105. package/src/runtime-pi/client/oohtml/namespacing.js +0 -7
  106. package/src/runtime-pi/client/oohtml/scripting.js +0 -8
  107. package/src/runtime-pi/client/oohtml/templating.js +0 -8
  108. package/src/runtime-pi/client/worker/Application.js +0 -44
  109. package/src/runtime-pi/client/worker/Runtime.js +0 -269
  110. package/src/runtime-pi/server/Application.js +0 -116
  111. package/src/runtime-pi/server/Runtime.js +0 -557
  112. package/src/runtime-pi/xFormData.js +0 -24
  113. package/src/runtime-pi/xHeaders.js +0 -146
  114. package/src/runtime-pi/xRequest.js +0 -46
  115. package/src/runtime-pi/xRequestHeaders.js +0 -109
  116. package/src/runtime-pi/xResponse.js +0 -33
  117. package/src/runtime-pi/xResponseHeaders.js +0 -117
  118. package/src/runtime-pi/xxHttpMessage.js +0 -102
@@ -1,74 +1,74 @@
1
-
2
- /**
3
- * imports
4
- */
5
- import { Dotfile } from '@webqit/backpack';
6
-
7
- export default class Proxy extends Dotfile {
8
-
9
- // Base name
10
- get name() {
11
- return 'proxy';
12
- }
13
-
14
- // @desc
15
- static get ['@desc']() {
16
- return 'Layout proxy config.';
17
- }
18
-
19
- // Defaults merger
20
- withDefaults(config) {
21
- return this.merge({
22
- entries: [],
23
- }, config, 'patch');
24
- }
25
-
26
- // Questions generator
27
- getSchema(config, choices = {}) {
28
- // Choices
29
- const CHOICES = this.merge({
30
- proto: [
31
- {value: '', title: '(Auto)'},
32
- {value: 'http', title: 'HTTP'},
33
- {value: 'https', title: 'HTTPS'},
34
- ],
35
- }, choices, 'patch');
36
- // Questions
37
- return [
38
- {
39
- name: 'entries',
40
- type: 'recursive',
41
- controls: {
42
- name: 'vhost',
43
- },
44
- initial: config.entries,
45
- schema: [
46
- {
47
- name: 'path',
48
- type: 'text',
49
- message: '[path]: Enter local pathname to target server if exists.' + "\r\n" + '(Leave empty to explicitly specify hostnames and port number.)' + "\r\n",
50
- },
51
- {
52
- name: 'hostnames',
53
- type: 'list',
54
- message: '[hostnames]: Enter host names.' + "\r\n" + '(Leave empty to automatically derive hostnames from the config of the target server specified above.)' + "\r\n",
55
- },
56
- {
57
- name: 'port',
58
- type: 'number',
59
- message: '[port]: Enter the target port number.' + "\r\n" + '(Leave empty to automatically derive target port number from the config of the target server specified above.)' + "\r\n",
60
- },
61
- {
62
- name: 'proto',
63
- type: 'select',
64
- message: '[protocol]: Enter the target protocol: https/http.' + "\r\n" + '(Leave empty to automatically derive target protocol from the config of the target server specified above.)' + "\r\n",
65
- choices: CHOICES.proto,
66
- initial: this.indexOfInitial(CHOICES.proto, config.proto),
67
- validation: ['important'],
68
- },
69
- ],
70
- },
71
-
72
- ];
73
- }
74
- }
1
+
2
+ /**
3
+ * imports
4
+ */
5
+ import { Dotfile } from '@webqit/backpack';
6
+
7
+ export default class Proxy extends Dotfile {
8
+
9
+ // Base name
10
+ get name() {
11
+ return 'proxy';
12
+ }
13
+
14
+ // @desc
15
+ static get ['@desc']() {
16
+ return 'Layout proxy config.';
17
+ }
18
+
19
+ // Defaults merger
20
+ withDefaults(config) {
21
+ return this.merge({
22
+ entries: [],
23
+ }, config, 'patch');
24
+ }
25
+
26
+ // Questions generator
27
+ getSchema(config, choices = {}) {
28
+ // Choices
29
+ const CHOICES = this.merge({
30
+ proto: [
31
+ {value: '', title: '(Auto)'},
32
+ {value: 'http', title: 'HTTP'},
33
+ {value: 'https', title: 'HTTPS'},
34
+ ],
35
+ }, choices, 'patch');
36
+ // Questions
37
+ return [
38
+ {
39
+ name: 'entries',
40
+ type: 'recursive',
41
+ controls: {
42
+ name: 'vhost',
43
+ },
44
+ initial: config.entries,
45
+ schema: [
46
+ {
47
+ name: 'path',
48
+ type: 'text',
49
+ message: '[path]: Enter local pathname to target server if exists.' + "\r\n" + '(Leave empty to explicitly specify hostnames and port number.)' + "\r\n",
50
+ },
51
+ {
52
+ name: 'hostnames',
53
+ type: 'list',
54
+ message: '[hostnames]: Enter host names.' + "\r\n" + '(Leave empty to automatically derive hostnames from the config of the target server specified above.)' + "\r\n",
55
+ },
56
+ {
57
+ name: 'port',
58
+ type: 'number',
59
+ message: '[port]: Enter the target port number.' + "\r\n" + '(Leave empty to automatically derive target port number from the config of the target server specified above.)' + "\r\n",
60
+ },
61
+ {
62
+ name: 'proto',
63
+ type: 'select',
64
+ message: '[protocol]: Enter the target protocol: https/http.' + "\r\n" + '(Leave empty to automatically derive target protocol from the config of the target server specified above.)' + "\r\n",
65
+ choices: CHOICES.proto,
66
+ initial: this.indexOfInitial(CHOICES.proto, config.proto),
67
+ validation: ['important'],
68
+ },
69
+ ],
70
+ },
71
+
72
+ ];
73
+ }
74
+ }
@@ -1,18 +1,18 @@
1
-
2
- /**
3
- * i@mports
4
- */
5
- import Env from './Env.js';
6
- import Layout from './Layout.js';
7
- import Origins from './Origins.js';
8
- import Proxy from './Proxy.js';
9
-
10
- /**
11
- * @exports
12
- */
13
- export {
14
- Env,
15
- Layout,
16
- Origins,
17
- Proxy,
1
+
2
+ /**
3
+ * i@mports
4
+ */
5
+ import Env from './Env.js';
6
+ import Layout from './Layout.js';
7
+ import Origins from './Origins.js';
8
+ import Proxy from './Proxy.js';
9
+
10
+ /**
11
+ * @exports
12
+ */
13
+ export {
14
+ Env,
15
+ Layout,
16
+ Origins,
17
+ Proxy,
18
18
  }
@@ -1,16 +1,16 @@
1
-
2
- /**
3
- * @imports
4
- */
5
- import * as deployment from './deployment/index.js';
6
- import * as runtime from './runtime/index.js';
7
- import * as $static from './static/index.js';
8
-
9
- /**
10
- * @exports
11
- */
12
- export {
13
- deployment,
14
- runtime,
15
- $static as static,
1
+
2
+ /**
3
+ * @imports
4
+ */
5
+ import * as deployment from './deployment/index.js';
6
+ import * as runtime from './runtime/index.js';
7
+ import * as $static from './static/index.js';
8
+
9
+ /**
10
+ * @exports
11
+ */
12
+ export {
13
+ deployment,
14
+ runtime,
15
+ $static as static,
16
16
  }
@@ -1,98 +1,116 @@
1
-
2
- /**
3
- * imports
4
- */
5
- import { Dotfile } from '@webqit/backpack';
6
-
7
- export default class Client extends Dotfile {
8
-
9
- // Base name
10
- get name() {
11
- return 'client';
12
- }
13
-
14
- // @desc
15
- static get ['@desc']() {
16
- return 'Client Runtime config.';
17
- }
18
-
19
- // Defaults merger
20
- withDefaults(config) {
21
- return this.merge({
22
- bundle_filename: 'bundle.js',
23
- public_base_url: '/',
24
- spa_routing: true,
25
- oohtml_support: 'full',
26
- service_worker_support: true,
27
- worker_scope: '/',
28
- worker_filename: 'worker.js',
29
- }, config, 'patch');
30
- }
31
-
32
- // Questions generator
33
- getSchema(config, choices = {}) {
34
- // Choices
35
- const CHOICES = this.merge({
36
- oohtml_support: [
37
- {value: 'full', title: 'Full'},
38
- {value: 'namespacing', title: 'namespacing'},
39
- {value: 'scripting', title: 'scripting'},
40
- {value: 'templating', title: 'templating'},
41
- {value: 'none', title: 'none'},
42
- ],
43
- }, choices, 'patch');
44
- // Questions
45
- return [
46
- {
47
- name: 'bundle_filename',
48
- type: 'text',
49
- message: 'Specify the bundle filename',
50
- initial: config.bundle_filename,
51
- },
52
- {
53
- name: 'public_base_url',
54
- type: 'text',
55
- message: '[public_base_url]: Enter the base-URL for public resource URLs',
56
- initial: DATA.public_base_url,
57
- validation: ['important'],
58
- },
59
- {
60
- name: 'spa_routing',
61
- type: 'toggle',
62
- message: '[spa_routing]: Enable Single Page Routing Mode',
63
- active: 'YES',
64
- inactive: 'NO',
65
- initial: config.spa_routing,
66
- validation: ['important'],
67
- },
68
- {
69
- name: 'oohtml_support',
70
- type: 'select',
71
- message: '[oohtml_support]: (Adds OOHTML to your app\'s bundle.) Specify OOHTML support level',
72
- choices: CHOICES.oohtml_support,
73
- initial: this.indexOfInitial(CHOICES.oohtml_support, config.oohtml_support),
74
- validation: ['important'],
75
- },
76
- {
77
- name: 'service_worker_support',
78
- type: 'toggle',
79
- message: 'Support Service Worker?',
80
- active: 'YES',
81
- inactive: 'NO',
82
- initial: config.service_worker_support,
83
- },
84
- {
85
- name: 'worker_scope',
86
- type: (prev, answers) => answers.service_worker_support ? 'text' : null,
87
- message: 'Specify the Service Worker scope',
88
- initial: config.worker_scope,
89
- },
90
- {
91
- name: 'worker_filename',
92
- type: (prev, answers) => answers.service_worker_support ? 'text' : null,
93
- message: 'Specify the Service Worker filename',
94
- initial: config.worker_filename,
95
- },
96
- ];
97
- }
98
- }
1
+
2
+ /**
3
+ * imports
4
+ */
5
+ import { Dotfile } from '@webqit/backpack';
6
+
7
+ export default class Client extends Dotfile {
8
+
9
+ // Base name
10
+ get name() {
11
+ return 'client';
12
+ }
13
+
14
+ // @desc
15
+ static get ['@desc']() {
16
+ return 'Client Runtime config.';
17
+ }
18
+
19
+ // Defaults merger
20
+ withDefaults(config) {
21
+ return this.merge({
22
+ bundle_filename: 'bundle.js',
23
+ public_base_url: '/',
24
+ spa_routing: true,
25
+ service_worker: {
26
+ filename: 'worker.js',
27
+ scope: '/',
28
+ support_push: false,
29
+ vapid_key_env: 'VAPID_PUBLIC_KEY',
30
+ push_registration_url_env: 'PUSH_REGISTRATION_PUBLIC_URL',
31
+ },
32
+ bundle_public_env: false,
33
+ }, config, 'patch');
34
+ }
35
+
36
+ // Questions generator
37
+ getSchema(config, choices = {}) {
38
+ // Choices
39
+ const CHOICES = this.merge({
40
+ webqit_dependencies: [
41
+ {value: 'externalize', title: 'Externalize'},
42
+ {value: 'internalize', title: 'Internalize'},
43
+ ],
44
+ }, choices, 'patch');
45
+ // Questions
46
+ return [
47
+ {
48
+ name: 'bundle_filename',
49
+ type: 'text',
50
+ message: 'Specify the bundle filename',
51
+ initial: config.bundle_filename,
52
+ },
53
+ {
54
+ name: 'public_base_url',
55
+ type: 'text',
56
+ message: '[public_base_url]: Enter the base-URL for public resource URLs',
57
+ initial: config.public_base_url,
58
+ validation: ['important'],
59
+ },
60
+ {
61
+ name: 'bundle_public_env',
62
+ type: 'toggle',
63
+ message: '[spa_routing]: Enable Single Page Routing Mode',
64
+ active: 'YES',
65
+ inactive: 'NO',
66
+ initial: config.spa_routing,
67
+ validation: ['important'],
68
+ },
69
+ {
70
+ name: 'service_worker',
71
+ controls: {
72
+ name: 'service_worker',
73
+ },
74
+ initial: config.service_worker,
75
+ schema: [
76
+ {
77
+ name: 'filename',
78
+ type: 'text',
79
+ message: 'Specify the Service Worker filename',
80
+ },
81
+ {
82
+ name: 'scope',
83
+ type: 'text',
84
+ message: 'Specify the Service Worker scope',
85
+ },
86
+ {
87
+ name: 'support_push',
88
+ type: 'toggle',
89
+ message: 'Support push-notifications?',
90
+ active: 'YES',
91
+ inactive: 'NO',
92
+ },
93
+ {
94
+ name: 'vapid_key_env',
95
+ type: (prev, answers) => answers.support_push ? 'text' : null,
96
+ message: 'Enter the VAPID KEY env id for push notification subscription',
97
+ },
98
+ {
99
+ name: 'push_registration_url_env',
100
+ type: (prev, answers) => answers.support_push ? 'text' : null,
101
+ message: 'Enter the URL for push notification subscription',
102
+ },
103
+ ],
104
+ },
105
+ {
106
+ name: 'bundle_public_env',
107
+ type: 'toggle',
108
+ message: '[bundle_public_env]: Bundle public ENV variables?',
109
+ active: 'YES',
110
+ inactive: 'NO',
111
+ initial: config.bundle_public_env,
112
+ validation: ['important'],
113
+ },
114
+ ];
115
+ }
116
+ }