@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.
- package/.gitignore +7 -7
- package/LICENSE +20 -20
- package/README.md +2079 -2074
- package/docker/Dockerfile +42 -42
- package/docker/README.md +91 -91
- package/docker/package.json +2 -2
- package/package.json +80 -81
- package/src/{Context.js → AbstractContext.js} +71 -79
- package/src/config-pi/deployment/Env.js +68 -68
- package/src/config-pi/deployment/Layout.js +63 -63
- package/src/config-pi/deployment/Origins.js +139 -139
- package/src/config-pi/deployment/Proxy.js +74 -74
- package/src/config-pi/deployment/index.js +17 -17
- package/src/config-pi/index.js +15 -15
- package/src/config-pi/runtime/Client.js +116 -98
- package/src/config-pi/runtime/Server.js +125 -125
- package/src/config-pi/runtime/client/Worker.js +109 -134
- package/src/config-pi/runtime/client/index.js +11 -11
- package/src/config-pi/runtime/index.js +17 -17
- package/src/config-pi/runtime/server/Headers.js +74 -74
- package/src/config-pi/runtime/server/Redirects.js +69 -69
- package/src/config-pi/runtime/server/index.js +13 -13
- package/src/config-pi/static/Manifest.js +319 -319
- package/src/config-pi/static/Ssg.js +49 -49
- package/src/config-pi/static/index.js +13 -13
- package/src/deployment-pi/index.js +10 -10
- package/src/deployment-pi/origins/index.js +216 -216
- package/src/index.js +11 -19
- package/src/runtime-pi/HttpEvent.js +126 -106
- package/src/runtime-pi/HttpUser.js +126 -0
- package/src/runtime-pi/MessagingOverBroadcast.js +9 -0
- package/src/runtime-pi/MessagingOverChannel.js +85 -0
- package/src/runtime-pi/MessagingOverSocket.js +106 -0
- package/src/runtime-pi/MultiportMessagingAPI.js +81 -0
- package/src/runtime-pi/WebfloCookieStorage.js +27 -0
- package/src/runtime-pi/WebfloEventTarget.js +39 -0
- package/src/runtime-pi/WebfloMessageEvent.js +58 -0
- package/src/runtime-pi/WebfloMessagingAPI.js +69 -0
- package/src/runtime-pi/{Router.js → WebfloRouter.js} +99 -130
- package/src/runtime-pi/WebfloRuntime.js +52 -0
- package/src/runtime-pi/WebfloStorage.js +109 -0
- package/src/runtime-pi/client/ClientMessaging.js +5 -0
- package/src/runtime-pi/client/Context.js +3 -7
- package/src/runtime-pi/client/CookieStorage.js +17 -0
- package/src/runtime-pi/client/Router.js +38 -48
- package/src/runtime-pi/client/SessionStorage.js +33 -0
- package/src/runtime-pi/client/Url.js +156 -205
- package/src/runtime-pi/client/WebfloClient.js +544 -0
- package/src/runtime-pi/client/WebfloRootClient1.js +179 -0
- package/src/runtime-pi/client/WebfloRootClient2.js +109 -0
- package/src/runtime-pi/client/WebfloSubClient.js +165 -0
- package/src/runtime-pi/client/Workport.js +118 -178
- package/src/runtime-pi/client/generate.js +480 -471
- package/src/runtime-pi/client/index.js +16 -21
- package/src/runtime-pi/client/worker/ClientMessaging.js +5 -0
- package/src/runtime-pi/client/worker/Context.js +3 -7
- package/src/runtime-pi/client/worker/CookieStorage.js +17 -0
- package/src/runtime-pi/client/worker/SessionStorage.js +13 -0
- package/src/runtime-pi/client/worker/WebfloWorker.js +294 -0
- package/src/runtime-pi/client/worker/Workport.js +17 -85
- package/src/runtime-pi/client/worker/index.js +10 -21
- package/src/runtime-pi/index.js +6 -13
- package/src/runtime-pi/server/ClientMessaging.js +18 -0
- package/src/runtime-pi/server/ClientMessagingRegistry.js +57 -0
- package/src/runtime-pi/server/Context.js +11 -15
- package/src/runtime-pi/server/CookieStorage.js +17 -0
- package/src/runtime-pi/server/Router.js +93 -159
- package/src/runtime-pi/server/SessionStorage.js +53 -0
- package/src/runtime-pi/server/WebfloServer.js +755 -0
- package/src/runtime-pi/server/index.js +10 -21
- package/src/runtime-pi/util-http.js +322 -86
- package/src/runtime-pi/util-url.js +146 -146
- package/src/runtime-pi/xURL.js +108 -105
- package/src/runtime-pi/xfetch.js +22 -22
- package/src/services-pi/cert/http-auth-hook.js +22 -22
- package/src/services-pi/cert/http-cleanup-hook.js +22 -22
- package/src/services-pi/cert/index.js +79 -79
- package/src/services-pi/index.js +8 -8
- package/src/static-pi/index.js +10 -10
- package/src/webflo.js +30 -30
- package/test/index.test.js +26 -26
- package/test/site/package.json +9 -9
- package/test/site/public/bundle.html +5 -5
- package/test/site/public/bundle.html.json +3 -3
- package/test/site/public/bundle.js +2 -2
- package/test/site/public/bundle.webflo.js +15 -15
- package/test/site/public/index.html +29 -29
- package/test/site/public/index1.html +34 -34
- package/test/site/public/page-2/bundle.html +4 -4
- package/test/site/public/page-2/bundle.js +2 -2
- package/test/site/public/page-2/index.html +45 -45
- package/test/site/public/page-2/main.html +2 -2
- package/test/site/public/page-4/subpage/bundle.js +2 -2
- package/test/site/public/page-4/subpage/index.html +30 -30
- package/test/site/public/sparoots.json +4 -4
- package/test/site/public/worker.js +3 -3
- package/test/site/server/index.js +15 -15
- package/src/runtime-pi/Application.js +0 -29
- package/src/runtime-pi/Cookies.js +0 -82
- package/src/runtime-pi/Runtime.js +0 -21
- package/src/runtime-pi/client/Application.js +0 -100
- package/src/runtime-pi/client/Runtime.js +0 -332
- package/src/runtime-pi/client/createStorage.js +0 -57
- package/src/runtime-pi/client/oohtml/full.js +0 -7
- package/src/runtime-pi/client/oohtml/namespacing.js +0 -7
- package/src/runtime-pi/client/oohtml/scripting.js +0 -8
- package/src/runtime-pi/client/oohtml/templating.js +0 -8
- package/src/runtime-pi/client/worker/Application.js +0 -44
- package/src/runtime-pi/client/worker/Runtime.js +0 -269
- package/src/runtime-pi/server/Application.js +0 -116
- package/src/runtime-pi/server/Runtime.js +0 -557
- package/src/runtime-pi/xFormData.js +0 -24
- package/src/runtime-pi/xHeaders.js +0 -146
- package/src/runtime-pi/xRequest.js +0 -46
- package/src/runtime-pi/xRequestHeaders.js +0 -109
- package/src/runtime-pi/xResponse.js +0 -33
- package/src/runtime-pi/xResponseHeaders.js +0 -117
- package/src/runtime-pi/xxHttpMessage.js +0 -102
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* imports
|
|
4
|
-
*/
|
|
5
|
-
import { Dotfile } from '@webqit/backpack';
|
|
6
|
-
|
|
7
|
-
export default class Server extends Dotfile {
|
|
8
|
-
|
|
9
|
-
// Base name
|
|
10
|
-
get name() {
|
|
11
|
-
return 'server';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// @desc
|
|
15
|
-
static get ['@desc']() {
|
|
16
|
-
return 'Server Runtime config.';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Defaults merger
|
|
20
|
-
withDefaults(config) {
|
|
21
|
-
return this.merge({
|
|
22
|
-
port: process.env.PORT || 3000,
|
|
23
|
-
domains: [],
|
|
24
|
-
https: {
|
|
25
|
-
port: process.env.SSL_PORT || 0,
|
|
26
|
-
domains: [],
|
|
27
|
-
keyfile: '/etc/letsencrypt/live/[domain]/privkey.pem',
|
|
28
|
-
certfile: '/etc/letsencrypt/live/[domain]/fullchain.pem',
|
|
29
|
-
force: false,
|
|
30
|
-
},
|
|
31
|
-
force_www: '',
|
|
32
|
-
oohtml_support: 'full',
|
|
33
|
-
}, config, 'patch');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Questions generator
|
|
37
|
-
getSchema(config, choices = {}) {
|
|
38
|
-
// Choices
|
|
39
|
-
const CHOICES = this.merge({
|
|
40
|
-
force_www: [
|
|
41
|
-
{value: '', title: 'do nothing'},
|
|
42
|
-
{value: 'add',},
|
|
43
|
-
{value: 'remove',},
|
|
44
|
-
],
|
|
45
|
-
oohtml_support: [
|
|
46
|
-
{value: 'full', title: 'full'},
|
|
47
|
-
{value: 'namespacing', title: 'namespacing'},
|
|
48
|
-
{value: 'scripting', title: 'scripting'},
|
|
49
|
-
{value: 'templating', title: 'templating'},
|
|
50
|
-
{value: 'none', title: 'none'},
|
|
51
|
-
],
|
|
52
|
-
}, choices, 'patch');
|
|
53
|
-
// Questions
|
|
54
|
-
return [
|
|
55
|
-
{
|
|
56
|
-
name: 'port',
|
|
57
|
-
type: 'number',
|
|
58
|
-
message: '[port]: Enter port number',
|
|
59
|
-
initial: config.port,
|
|
60
|
-
validation: ['important'],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'domains',
|
|
64
|
-
type: 'list',
|
|
65
|
-
message: '[domains]: Enter a list of allowed domains if necessary (comma-separated)',
|
|
66
|
-
validation: ['important'],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'force_www',
|
|
70
|
-
type: 'select',
|
|
71
|
-
message: '[force_www]: Force add/remove "www" on hostname?',
|
|
72
|
-
choices: CHOICES.force_www,
|
|
73
|
-
initial: this.indexOfInitial(CHOICES.force_www, config.force_www),
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 'https',
|
|
77
|
-
controls: {
|
|
78
|
-
name: 'https',
|
|
79
|
-
},
|
|
80
|
-
initial: config.https,
|
|
81
|
-
schema: [
|
|
82
|
-
{
|
|
83
|
-
name: 'port',
|
|
84
|
-
type: 'number',
|
|
85
|
-
message: '[port]: Enter HTTPS port number',
|
|
86
|
-
validation: ['important'],
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: 'keyfile',
|
|
90
|
-
type: 'text',
|
|
91
|
-
message: '[keyfile]: Enter SSL KEY file',
|
|
92
|
-
validation: ['important'],
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'certfile',
|
|
96
|
-
type: 'text',
|
|
97
|
-
message: '[certfile]: Enter SSL CERT file',
|
|
98
|
-
validation: ['important'],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'domains',
|
|
102
|
-
type: 'list',
|
|
103
|
-
message: '[domains]: Enter the CERT domains (comma-separated)',
|
|
104
|
-
validation: ['important'],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: 'force',
|
|
108
|
-
type: 'toggle',
|
|
109
|
-
message: '[force]: Force HTTPS?',
|
|
110
|
-
active: 'YES',
|
|
111
|
-
inactive: 'NO',
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: 'oohtml_support',
|
|
117
|
-
type: 'select',
|
|
118
|
-
message: '[oohtml_support]: Specify OOHTML support level',
|
|
119
|
-
choices: CHOICES.oohtml_support,
|
|
120
|
-
initial: this.indexOfInitial(CHOICES.oohtml_support, config.oohtml_support),
|
|
121
|
-
validation: ['important'],
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* imports
|
|
4
|
+
*/
|
|
5
|
+
import { Dotfile } from '@webqit/backpack';
|
|
6
|
+
|
|
7
|
+
export default class Server extends Dotfile {
|
|
8
|
+
|
|
9
|
+
// Base name
|
|
10
|
+
get name() {
|
|
11
|
+
return 'server';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// @desc
|
|
15
|
+
static get ['@desc']() {
|
|
16
|
+
return 'Server Runtime config.';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Defaults merger
|
|
20
|
+
withDefaults(config) {
|
|
21
|
+
return this.merge({
|
|
22
|
+
port: process.env.PORT || 3000,
|
|
23
|
+
domains: [],
|
|
24
|
+
https: {
|
|
25
|
+
port: process.env.SSL_PORT || 0,
|
|
26
|
+
domains: [],
|
|
27
|
+
keyfile: '/etc/letsencrypt/live/[domain]/privkey.pem',
|
|
28
|
+
certfile: '/etc/letsencrypt/live/[domain]/fullchain.pem',
|
|
29
|
+
force: false,
|
|
30
|
+
},
|
|
31
|
+
force_www: '',
|
|
32
|
+
oohtml_support: 'full',
|
|
33
|
+
}, config, 'patch');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Questions generator
|
|
37
|
+
getSchema(config, choices = {}) {
|
|
38
|
+
// Choices
|
|
39
|
+
const CHOICES = this.merge({
|
|
40
|
+
force_www: [
|
|
41
|
+
{value: '', title: 'do nothing'},
|
|
42
|
+
{value: 'add',},
|
|
43
|
+
{value: 'remove',},
|
|
44
|
+
],
|
|
45
|
+
oohtml_support: [
|
|
46
|
+
{value: 'full', title: 'full'},
|
|
47
|
+
{value: 'namespacing', title: 'namespacing'},
|
|
48
|
+
{value: 'scripting', title: 'scripting'},
|
|
49
|
+
{value: 'templating', title: 'templating'},
|
|
50
|
+
{value: 'none', title: 'none'},
|
|
51
|
+
],
|
|
52
|
+
}, choices, 'patch');
|
|
53
|
+
// Questions
|
|
54
|
+
return [
|
|
55
|
+
{
|
|
56
|
+
name: 'port',
|
|
57
|
+
type: 'number',
|
|
58
|
+
message: '[port]: Enter port number',
|
|
59
|
+
initial: config.port,
|
|
60
|
+
validation: ['important'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'domains',
|
|
64
|
+
type: 'list',
|
|
65
|
+
message: '[domains]: Enter a list of allowed domains if necessary (comma-separated)',
|
|
66
|
+
validation: ['important'],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'force_www',
|
|
70
|
+
type: 'select',
|
|
71
|
+
message: '[force_www]: Force add/remove "www" on hostname?',
|
|
72
|
+
choices: CHOICES.force_www,
|
|
73
|
+
initial: this.indexOfInitial(CHOICES.force_www, config.force_www),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'https',
|
|
77
|
+
controls: {
|
|
78
|
+
name: 'https',
|
|
79
|
+
},
|
|
80
|
+
initial: config.https,
|
|
81
|
+
schema: [
|
|
82
|
+
{
|
|
83
|
+
name: 'port',
|
|
84
|
+
type: 'number',
|
|
85
|
+
message: '[port]: Enter HTTPS port number',
|
|
86
|
+
validation: ['important'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'keyfile',
|
|
90
|
+
type: 'text',
|
|
91
|
+
message: '[keyfile]: Enter SSL KEY file',
|
|
92
|
+
validation: ['important'],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'certfile',
|
|
96
|
+
type: 'text',
|
|
97
|
+
message: '[certfile]: Enter SSL CERT file',
|
|
98
|
+
validation: ['important'],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'domains',
|
|
102
|
+
type: 'list',
|
|
103
|
+
message: '[domains]: Enter the CERT domains (comma-separated)',
|
|
104
|
+
validation: ['important'],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'force',
|
|
108
|
+
type: 'toggle',
|
|
109
|
+
message: '[force]: Force HTTPS?',
|
|
110
|
+
active: 'YES',
|
|
111
|
+
inactive: 'NO',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'oohtml_support',
|
|
117
|
+
type: 'select',
|
|
118
|
+
message: '[oohtml_support]: Specify OOHTML support level',
|
|
119
|
+
choices: CHOICES.oohtml_support,
|
|
120
|
+
initial: this.indexOfInitial(CHOICES.oohtml_support, config.oohtml_support),
|
|
121
|
+
validation: ['important'],
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -1,134 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* imports
|
|
4
|
-
*/
|
|
5
|
-
import { _isNumeric } from '@webqit/util/js/index.js';
|
|
6
|
-
import { _before, _after } from '@webqit/util/str/index.js';
|
|
7
|
-
import { Dotfile } from '@webqit/backpack';
|
|
8
|
-
|
|
9
|
-
export default class Worker extends Dotfile {
|
|
10
|
-
|
|
11
|
-
// Base name
|
|
12
|
-
get name() {
|
|
13
|
-
return 'worker';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// @desc
|
|
17
|
-
static get ['@desc']() {
|
|
18
|
-
return 'Application Service Worker config.';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Defaults merger
|
|
22
|
-
withDefaults(config) {
|
|
23
|
-
return this.merge({
|
|
24
|
-
cache_name: 'cache_v0',
|
|
25
|
-
default_fetching_strategy: 'network-first',
|
|
26
|
-
network_first_urls: [],
|
|
27
|
-
cache_first_urls: [],
|
|
28
|
-
network_only_urls: [],
|
|
29
|
-
cache_only_urls: [],
|
|
30
|
-
skip_waiting: true,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'push_registration_url',
|
|
113
|
-
type: (prev, answers) => answers.support_push ? 'text' : null,
|
|
114
|
-
message: 'Enter the URL for push notification subscription',
|
|
115
|
-
initial: config.push_registration_url,
|
|
116
|
-
validation: ['important'],
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: 'push_deregistration_url',
|
|
120
|
-
type: (prev, answers) => answers.support_push ? 'text' : null,
|
|
121
|
-
message: 'Enter the URL for push notification unsubscription',
|
|
122
|
-
initial: config.push_deregistration_url,
|
|
123
|
-
validation: ['important'],
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'push_key',
|
|
127
|
-
type: (prev, answers) => answers.support_push ? 'text' : null,
|
|
128
|
-
message: 'Enter the Public Key for push notification subscription',
|
|
129
|
-
initial: config.push_key,
|
|
130
|
-
validation: ['important'],
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* imports
|
|
4
|
+
*/
|
|
5
|
+
import { _isNumeric } from '@webqit/util/js/index.js';
|
|
6
|
+
import { _before, _after } from '@webqit/util/str/index.js';
|
|
7
|
+
import { Dotfile } from '@webqit/backpack';
|
|
8
|
+
|
|
9
|
+
export default class Worker extends Dotfile {
|
|
10
|
+
|
|
11
|
+
// Base name
|
|
12
|
+
get name() {
|
|
13
|
+
return 'worker';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// @desc
|
|
17
|
+
static get ['@desc']() {
|
|
18
|
+
return 'Application Service Worker config.';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Defaults merger
|
|
22
|
+
withDefaults(config) {
|
|
23
|
+
return this.merge({
|
|
24
|
+
cache_name: 'cache_v0',
|
|
25
|
+
default_fetching_strategy: 'network-first',
|
|
26
|
+
network_first_urls: [],
|
|
27
|
+
cache_first_urls: [],
|
|
28
|
+
network_only_urls: [],
|
|
29
|
+
cache_only_urls: [],
|
|
30
|
+
skip_waiting: true,
|
|
31
|
+
bundle_public_env: false,
|
|
32
|
+
}, config, 'patch');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Questions generator
|
|
36
|
+
getSchema(config, choices = {}) {
|
|
37
|
+
// Increment cache
|
|
38
|
+
if (config.cache_name && config.cache_name.indexOf('_v') > -1 && _isNumeric(_after(config.cache_name, '_v'))) {
|
|
39
|
+
config.cache_name = _before(config.cache_name, '_v') + '_v' + (parseInt(_after(config.cache_name, '_v')) + 1);
|
|
40
|
+
}
|
|
41
|
+
// Choices
|
|
42
|
+
const CHOICES = this.merge({
|
|
43
|
+
default_fetching_strategy: [
|
|
44
|
+
{value: 'network-first', title: 'Network-first (Webflo default)'},
|
|
45
|
+
{value: 'cache-first', title: 'Cache-first'},
|
|
46
|
+
{value: 'network-only', title: 'Network-only'},
|
|
47
|
+
{value: 'cache-only', title: 'Cache-only'},
|
|
48
|
+
],
|
|
49
|
+
}, choices, 'patch');
|
|
50
|
+
// Questions
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
name: 'cache_name',
|
|
54
|
+
type: 'text',
|
|
55
|
+
message: 'Enter the Service Worker cache name',
|
|
56
|
+
initial: config.cache_name,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'default_fetching_strategy',
|
|
60
|
+
type: 'select',
|
|
61
|
+
message: '[default_fetching_strategy]: Choose the default fetching strategy',
|
|
62
|
+
choices: CHOICES.default_fetching_strategy,
|
|
63
|
+
initial: this.indexOfInitial(CHOICES.default_fetching_strategy, config.default_fetching_strategy),
|
|
64
|
+
validation: ['important'],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'network_first_urls',
|
|
68
|
+
type: (prev, answers) => answers.default_fetching_strategy === 'network-first' ? null : 'list',
|
|
69
|
+
message: 'Specify URLs for a "network-first-then-cache" fetching strategy (comma-separated, globe supported)',
|
|
70
|
+
initial: (config.network_first_urls || []).join(', '),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'cache_first_urls',
|
|
74
|
+
type: (prev, answers) => answers.default_fetching_strategy === 'cache-first' ? null : 'list',
|
|
75
|
+
message: 'Specify URLs for a "cache-first-then-network" fetching strategy (comma-separated, globe supported)',
|
|
76
|
+
initial: (config.cache_first_urls || []).join(', '),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'network_only_urls',
|
|
80
|
+
type: (prev, answers) => answers.default_fetching_strategy === 'network-only' ? null : 'list',
|
|
81
|
+
message: 'Specify URLs for a "network-only" fetching strategy (comma-separated, globe supported)',
|
|
82
|
+
initial: (config.network_only_urls || []).join(', '),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'cache_only_urls',
|
|
86
|
+
type: (prev, answers) => answers.default_fetching_strategy === 'cache-only' ? null : 'list',
|
|
87
|
+
message: 'Specify URLs for a "cache-only" fetching strategy (comma-separated, globe supported)',
|
|
88
|
+
initial: (config.cache_only_urls || []).join(', '),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'skip_waiting',
|
|
92
|
+
type: 'toggle',
|
|
93
|
+
message: 'Choose whether to skip the "waiting" state for updated Service Workers',
|
|
94
|
+
active: 'YES',
|
|
95
|
+
inactive: 'NO',
|
|
96
|
+
initial: config.skip_waiting,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'bundle_public_env',
|
|
100
|
+
type: 'toggle',
|
|
101
|
+
message: '[bundle_public_env]: Bundle public ENV variables?',
|
|
102
|
+
active: 'YES',
|
|
103
|
+
inactive: 'NO',
|
|
104
|
+
initial: config.bundle_public_env,
|
|
105
|
+
validation: ['important'],
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @imports
|
|
4
|
-
*/
|
|
5
|
-
import Worker from './Worker.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @exports
|
|
9
|
-
*/
|
|
10
|
-
export {
|
|
11
|
-
Worker,
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @imports
|
|
4
|
+
*/
|
|
5
|
+
import Worker from './Worker.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @exports
|
|
9
|
+
*/
|
|
10
|
+
export {
|
|
11
|
+
Worker,
|
|
12
12
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @imports
|
|
4
|
-
*/
|
|
5
|
-
import Client from './Client.js';
|
|
6
|
-
import Server from './Server.js';
|
|
7
|
-
import * as client from './client/index.js';
|
|
8
|
-
import * as server from './server/index.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @exports
|
|
12
|
-
*/
|
|
13
|
-
export {
|
|
14
|
-
Client,
|
|
15
|
-
Server,
|
|
16
|
-
client,
|
|
17
|
-
server,
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @imports
|
|
4
|
+
*/
|
|
5
|
+
import Client from './Client.js';
|
|
6
|
+
import Server from './Server.js';
|
|
7
|
+
import * as client from './client/index.js';
|
|
8
|
+
import * as server from './server/index.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @exports
|
|
12
|
+
*/
|
|
13
|
+
export {
|
|
14
|
+
Client,
|
|
15
|
+
Server,
|
|
16
|
+
client,
|
|
17
|
+
server,
|
|
18
18
|
}
|