@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,147 +1,147 @@
1
-
2
- /**
3
- * @imports
4
- */
5
- import { _isString, _isNumeric, _isArray, _isTypeObject } from '@webqit/util/js/index.js';
6
- if (typeof URLPattern === 'undefined') {
7
- await import('urlpattern-polyfill');
8
- }
9
-
10
- export const params = {
11
- // Parse a search params string into an object
12
- parse(str, delim = '&') {
13
- str = str || '';
14
- const target = {};
15
- (str.startsWith('?') ? str.substr(1) : str)
16
- .split(delim).filter(q => q).map(q => q.split('=').map(q => q.trim()))
17
- .forEach(q => this.set(target, q[0], decodeURIComponent(q[1])));
18
- return target;
19
- },
20
- // Stringify an object into a search params string
21
- stringify(targetObject, delim = '&') {
22
- const q = [];
23
- Object.keys(targetObject).forEach(key => {
24
- this.reduceValue(targetObject[key], key, (_value, _pathNotation, suggestedKeys = undefined) => {
25
- if (suggestedKeys) return suggestedKeys;
26
- q.push(`${_pathNotation}=${encodeURIComponent(_value)}`);
27
- });
28
- });
29
- return q.join(delim);
30
- },
31
-
32
- // Get value by path notation
33
- get(targetObject, pathNotation) {
34
- return this.reducePath(pathNotation, targetObject, (key, _targetObject) => {
35
- if (!_targetObject && _targetObject !== 0) return;
36
- return _targetObject[key];
37
- });
38
- },
39
- // Set value by path notation
40
- set(targetObject, pathNotation, value) {
41
- this.reducePath(pathNotation, targetObject, function(_key, _targetObject, suggestedBranch = undefined) {
42
- let _value = value;
43
- if (suggestedBranch) { _value = suggestedBranch; }
44
- if (_key === '' && _isArray(_targetObject)) {
45
- _targetObject.push(_value);
46
- } else {
47
- _targetObject[_key] = _value;
48
- }
49
- return _value;
50
- });
51
- },
52
-
53
- // Resolve a value to its leaf nodes
54
- reduceValue(value, contextPath, callback) {
55
- if (_isTypeObject(value)) {
56
- let suggestedKeys = Object.keys(value);
57
- let keys = callback(value, contextPath, suggestedKeys);
58
- if (_isArray(keys)) {
59
- return keys.forEach(key => {
60
- this.reduceValue(value[key], contextPath ? `${contextPath}[${key}]` : key, callback);
61
- });
62
- }
63
- }
64
- callback(value, contextPath);
65
- },
66
- // Resolve a path to its leaf index
67
- reducePath(pathNotation, contextObject, callback) {
68
- if (_isString(pathNotation) && pathNotation.endsWith(']') && _isTypeObject(contextObject)) {
69
- let [ key, ...rest ] = pathNotation.split('[');
70
- if (_isNumeric(key)) { key = parseInt(key); }
71
- rest = rest.join('[').replace(']', '');
72
- let branch;
73
- if (key in contextObject) {
74
- branch = contextObject[key];
75
- } else {
76
- let suggestedBranch = rest === '' || _isNumeric(rest.split('[')[0]) ? [] : {};
77
- branch = callback(key, contextObject, suggestedBranch);
78
- }
79
- return this.reducePath(rest, branch, callback);
80
- }
81
- if (_isNumeric(pathNotation)) { pathNotation = parseInt(pathNotation); }
82
- return callback(pathNotation, contextObject);
83
- },
84
- };
85
-
86
- export const path = {
87
- join(/* path segments */) {
88
- // Split the inputs into a list of path commands.
89
- var parts = [], backsteps = 0;
90
- for (var i = 0, l = arguments.length; i < l; i++) {
91
- parts = parts.concat(arguments[i].split("/"));
92
- }
93
- // Interpret the path commands to get the new resolved path.
94
- var newParts = [];
95
- for (i = 0, l = parts.length; i < l; i++) {
96
- var part = parts[i];
97
- // Remove leading and trailing slashes
98
- // Also remove "." segments
99
- if (!part || part === ".") continue;
100
- // Interpret ".." to pop the last segment
101
- if (part === "..") {
102
- if (!newParts.length) backsteps ++;
103
- else newParts.pop();
104
- }
105
- // Push new path segments.
106
- else newParts.push(part);
107
- }
108
- // Preserve the initial slash if there was one.
109
- if (parts[0] === "") newParts.unshift("");
110
- // Turn back into a single string path.
111
- return '../'.repeat(backsteps) + newParts.join("/") || (newParts.length ? "/" : ".");
112
- },
113
- // A simple function to get the dirname of a path
114
- // Trailing slashes are ignored. Leading slash is preserved.
115
- dirname(path) {
116
- return this.join(path, "..");
117
- }
118
- };
119
-
120
- export const pattern = (pattern, baseUrl = null) => ({
121
- pattern: new URLPattern(pattern, baseUrl),
122
- isPattern() {
123
- return Object.keys(this.pattern.keys || {}).some(compName => this.pattern.keys[compName].length);
124
- },
125
- test(...args) { return this.pattern.test(...args) },
126
- exec(...args) {
127
- let components = this.pattern.exec(...args);
128
- if (!components) return;
129
- components.vars = Object.keys(this.pattern.keys).reduce(({ named, unnamed }, compName) => {
130
- this.pattern.keys[compName].forEach(key => {
131
- let value = components[compName].groups[key.name];
132
- if (typeof key.name === 'number') {
133
- unnamed.push(value);
134
- } else {
135
- named[key.name] = value;
136
- }
137
- });
138
- return { named, unnamed };
139
- }, { named: {}, unnamed: [] });
140
- components.render = str => {
141
- return str.replace(/\$(\$|[0-9A-Z]+)/gi, (a, b) => {
142
- return b === '$' ? '$' : (_isNumeric(b) ? components.vars.unnamed[b - 1] : components.vars.named[b]) || '';
143
- });
144
- }
145
- return components;
146
- }
1
+
2
+ /**
3
+ * @imports
4
+ */
5
+ import { _isString, _isNumeric, _isArray, _isTypeObject } from '@webqit/util/js/index.js';
6
+ if (typeof URLPattern === 'undefined') {
7
+ await import('urlpattern-polyfill');
8
+ }
9
+
10
+ export const params = {
11
+ // Parse a search params string into an object
12
+ parse(str, delim = '&') {
13
+ str = str || '';
14
+ const target = {};
15
+ (str.startsWith('?') ? str.substr(1) : str)
16
+ .split(delim).filter(q => q).map(q => q.split('=').map(q => q.trim()))
17
+ .forEach(q => this.set(target, q[0], decodeURIComponent(q[1])));
18
+ return target;
19
+ },
20
+ // Stringify an object into a search params string
21
+ stringify(targetObject, delim = '&') {
22
+ const q = [];
23
+ Object.keys(targetObject).forEach(key => {
24
+ this.reduceValue(targetObject[key], key, (_value, _pathNotation, suggestedKeys = undefined) => {
25
+ if (suggestedKeys) return suggestedKeys;
26
+ q.push(`${_pathNotation}=${encodeURIComponent(_value)}`);
27
+ });
28
+ });
29
+ return q.join(delim);
30
+ },
31
+
32
+ // Get value by path notation
33
+ get(targetObject, pathNotation) {
34
+ return this.reducePath(pathNotation, targetObject, (key, _targetObject) => {
35
+ if (!_targetObject && _targetObject !== 0) return;
36
+ return _targetObject[key];
37
+ });
38
+ },
39
+ // Set value by path notation
40
+ set(targetObject, pathNotation, value) {
41
+ this.reducePath(pathNotation, targetObject, function(_key, _targetObject, suggestedBranch = undefined) {
42
+ let _value = value;
43
+ if (suggestedBranch) { _value = suggestedBranch; }
44
+ if (_key === '' && _isArray(_targetObject)) {
45
+ _targetObject.push(_value);
46
+ } else {
47
+ _targetObject[_key] = _value;
48
+ }
49
+ return _value;
50
+ });
51
+ },
52
+
53
+ // Resolve a value to its leaf nodes
54
+ reduceValue(value, contextPath, callback) {
55
+ if (_isTypeObject(value)) {
56
+ let suggestedKeys = Object.keys(value);
57
+ let keys = callback(value, contextPath, suggestedKeys);
58
+ if (_isArray(keys)) {
59
+ return keys.forEach(key => {
60
+ this.reduceValue(value[key], contextPath ? `${contextPath}[${key}]` : key, callback);
61
+ });
62
+ }
63
+ }
64
+ callback(value, contextPath);
65
+ },
66
+ // Resolve a path to its leaf index
67
+ reducePath(pathNotation, contextObject, callback) {
68
+ if (_isString(pathNotation) && pathNotation.endsWith(']') && _isTypeObject(contextObject)) {
69
+ let [ key, ...rest ] = pathNotation.split('[');
70
+ if (_isNumeric(key)) { key = parseInt(key); }
71
+ rest = rest.join('[').replace(']', '');
72
+ let branch;
73
+ if (key in contextObject) {
74
+ branch = contextObject[key];
75
+ } else {
76
+ let suggestedBranch = rest === '' || _isNumeric(rest.split('[')[0]) ? [] : {};
77
+ branch = callback(key, contextObject, suggestedBranch);
78
+ }
79
+ return this.reducePath(rest, branch, callback);
80
+ }
81
+ if (_isNumeric(pathNotation)) { pathNotation = parseInt(pathNotation); }
82
+ return callback(pathNotation, contextObject);
83
+ },
84
+ };
85
+
86
+ export const path = {
87
+ join(/* path segments */) {
88
+ // Split the inputs into a list of path commands.
89
+ let parts = [], backsteps = 0;
90
+ for ( let i = 0, l = arguments.length; i < l; i++ ) {
91
+ parts = parts.concat( arguments[ i ].split( '/' ) );
92
+ }
93
+ // Interpret the path commands to get the new resolved path.
94
+ let newParts = [];
95
+ for ( let i = 0, l = parts.length; i < l; i++ ) {
96
+ let part = parts[ i ];
97
+ // Remove leading and trailing slashes
98
+ // Also remove "." segments
99
+ if ( !part || part === '.' ) continue;
100
+ // Interpret ".." to pop the last segment
101
+ if ( part === '..' ) {
102
+ if ( !newParts.length ) backsteps ++;
103
+ else newParts.pop();
104
+ }
105
+ // Push new path segments.
106
+ else newParts.push( part );
107
+ }
108
+ // Preserve the initial slash if there was one.
109
+ if ( parts[ 0 ] === '' ) newParts.unshift( '' );
110
+ // Turn back into a single string path.
111
+ return '../'.repeat( backsteps ) + newParts.join( '/' ) || ( newParts.length ? '/' : '.' );
112
+ },
113
+ // A simple function to get the dirname of a path
114
+ // Trailing slashes are ignored. Leading slash is preserved.
115
+ dirname( path ) {
116
+ return this.join( path, '..' );
117
+ }
118
+ };
119
+
120
+ export const pattern = (pattern, baseUrl = null) => ({
121
+ pattern: new URLPattern(pattern, baseUrl),
122
+ isPattern() {
123
+ return Object.keys(this.pattern.keys || {}).some(compName => this.pattern.keys[compName].length);
124
+ },
125
+ test(...args) { return this.pattern.test(...args) },
126
+ exec(...args) {
127
+ let components = this.pattern.exec(...args);
128
+ if (!components) return;
129
+ components.vars = Object.keys(this.pattern.keys).reduce(({ named, unnamed }, compName) => {
130
+ this.pattern.keys[compName].forEach(key => {
131
+ let value = components[compName].groups[key.name];
132
+ if (typeof key.name === 'number') {
133
+ unnamed.push(value);
134
+ } else {
135
+ named[key.name] = value;
136
+ }
137
+ });
138
+ return { named, unnamed };
139
+ }, { named: {}, unnamed: [] });
140
+ components.render = str => {
141
+ return str.replace(/\$(\$|[0-9A-Z]+)/gi, (a, b) => {
142
+ return b === '$' ? '$' : (_isNumeric(b) ? components.vars.unnamed[b - 1] : components.vars.named[b]) || '';
143
+ });
144
+ }
145
+ return components;
146
+ }
147
147
  });
@@ -1,105 +1,108 @@
1
-
2
- /**
3
- * @imports
4
- */
5
- import { _isObject, _isArray } from '@webqit/util/js/index.js';
6
- import { params } from './util-url.js';
7
-
8
- /**
9
- * ---------------------------
10
- * The xURL Mixin
11
- * ---------------------------
12
- */
13
- export default class xURL extends URL {
14
-
15
- // constructor
16
- constructor(...args) {
17
- super(...args);
18
- var query = params.parse(this.search);
19
- const updateSearch = query => {
20
- // "query" was updated. So we update "search"
21
- var search = params.stringify(query);
22
- search = search ? '?' + search : '';
23
- if (search !== this.search) {
24
- this.search = search;
25
- }
26
- };
27
- this.__query = {
28
- value: query,
29
- proxy: new Proxy(query, {
30
- set(t, n, v) {
31
- t[n] = v;
32
- updateSearch(t);
33
- return true;
34
- },
35
- deleteProperty(t, n) {
36
- delete t[n];
37
- updateSearch(t);
38
- return true;
39
- }
40
- })
41
- };
42
- }
43
-
44
- // Set search
45
- set search(value) {
46
- super.search = value;
47
- // "search" was updated. So we update "query"
48
- var query = params.parse(value);
49
- if (!_strictEven(query, this.query)) {
50
- this.query = query;
51
- }
52
- }
53
-
54
- // Get search
55
- get search() {
56
- return super.search;
57
- }
58
-
59
- // Get query
60
- get query() {
61
- return this.__query.proxy;
62
- }
63
-
64
- };
65
- // ----------
66
- xURL.Observable = class extends xURL {
67
-
68
- constructor() {
69
- super(...arguments);
70
- const { Observer } = WebQit;
71
- Observer.accessorize(this, [
72
- 'protocol',
73
- 'username',
74
- 'password',
75
- 'host',
76
- 'hostname',
77
- 'port',
78
- 'origin',
79
- 'pathname',
80
- 'search',
81
- 'query',
82
- 'hash',
83
- 'href',
84
- ]);
85
- }
86
-
87
- };
88
-
89
- /**
90
- * ---------------------------
91
- * Helpers
92
- * ---------------------------
93
- */
94
- var _strictEven = (a, b) => {
95
- if (_isObject(a) && _isObject(b)) {
96
- return _strictEven(Object.keys(a), Object.keys(b))
97
- && _strictEven(Object.values(a), Object.values(b));
98
- }
99
- if (_isArray(a) && _isArray(b)) {
100
- return a.length === b.length
101
- && a.reduce((recieved, item, i) => recieved && item === b[i], true);
102
- }
103
- return a === b;
104
- };
105
-
1
+
2
+ /**
3
+ * @imports
4
+ */
5
+ import { _isObject, _isArray } from '@webqit/util/js/index.js';
6
+ import { params } from './util-url.js';
7
+
8
+ /**
9
+ * ---------------------------
10
+ * The xURL Mixin
11
+ * ---------------------------
12
+ */
13
+ export default class xURL extends URL {
14
+
15
+ // constructor
16
+ constructor(...args) {
17
+ super(...args);
18
+ const query = params.parse(this.search);
19
+ const updateSearch = () => {
20
+ // "query" was updated. So we update "search"
21
+ let search = params.stringify(query);
22
+ search = search ? '?' + search : '';
23
+ if (search !== this.search) {
24
+ this.search = search;
25
+ }
26
+ };
27
+ const $this = this;
28
+ this._query = new Proxy(query, {
29
+ set(t, k, v) {
30
+ t[k] = v;
31
+ if (!$this._updatingSearch) updateSearch();
32
+ return true;
33
+ },
34
+ deleteProperty(t, k) {
35
+ delete t[k];
36
+ if (!$this._updatingSearch) updateSearch();
37
+ return true;
38
+ }
39
+ });
40
+ }
41
+
42
+ // Set search
43
+ set search(value) {
44
+ super.search = value;
45
+ // "search" was updated. So we update "query"
46
+ this._updatingSearch = true;
47
+ const query = params.parse(value);
48
+ const keys_a = Object.keys(query);
49
+ const keys_b = Object.keys(this._query);
50
+ for (const k of new Set([...keys_a,...keys_b])) {
51
+ if (!keys_a.includes(k)) delete this.query[k];
52
+ if (!keys_b.includes(k)) this.query[k] = query[k];
53
+ }
54
+ this._updatingSearch = false;
55
+ }
56
+
57
+ // Get search
58
+ get search() {
59
+ return super.search;
60
+ }
61
+
62
+ // Get query
63
+ get query() {
64
+ return this._query;
65
+ }
66
+
67
+ };
68
+ // ----------
69
+ xURL.Observable = class extends xURL {
70
+
71
+ constructor() {
72
+ super(...arguments);
73
+ const { Observer } = webqit;
74
+ Observer.accessorize(this, [
75
+ 'protocol',
76
+ 'username',
77
+ 'password',
78
+ 'host',
79
+ 'hostname',
80
+ 'port',
81
+ 'origin',
82
+ 'pathname',
83
+ 'search',
84
+ 'query',
85
+ 'hash',
86
+ 'href',
87
+ ]);
88
+ }
89
+
90
+ };
91
+
92
+ /**
93
+ * ---------------------------
94
+ * Helpers
95
+ * ---------------------------
96
+ */
97
+ var _strictEven = (a, b) => {
98
+ if (_isObject(a) && _isObject(b)) {
99
+ return _strictEven(Object.keys(a), Object.keys(b))
100
+ && _strictEven(Object.values(a), Object.values(b));
101
+ }
102
+ if (_isArray(a) && _isArray(b)) {
103
+ return a.length === b.length
104
+ && a.reduce((recieved, item, i) => recieved && item === b[i], true);
105
+ }
106
+ return a === b;
107
+ };
108
+
@@ -1,23 +1,23 @@
1
-
2
- /**
3
- * @imports
4
- */
5
- import { formatMessage } from './util-http.js';
6
-
7
- /**
8
- * The xfetch Mixin
9
- */
10
- const xfetch = async (url, init = {}) => {
11
- if (init.body) {
12
- const [ body, headers ] = formatMessage(init);
13
- init = { ...init, body, headers, };
14
- }
15
- let response = await fetch(url, init), encoding;
16
- if (init.decompress === false && (encoding = response.headers.get('Content-Encoding'))) {
17
- let recompressedBody = response.body.pipeThrough(new CompressionStream(encoding));
18
- response = new Response(recompressedBody, response);
19
- }
20
- return response;
21
- };
22
-
1
+
2
+ /**
3
+ * @imports
4
+ */
5
+ import { renderHttpMessageInit } from './util-http.js';
6
+
7
+ /**
8
+ * The xfetch Mixin
9
+ */
10
+ const xfetch = async (url, init = {}) => {
11
+ if (init.body) {
12
+ const { body, headers } = renderHttpMessageInit(init);
13
+ init = { ...init, body, headers, };
14
+ }
15
+ let response = await fetch(url, init), encoding;
16
+ if (init.decompress === false && (encoding = response.headers.get('Content-Encoding'))) {
17
+ let recompressedBody = response.body.pipeThrough(new CompressionStream(encoding));
18
+ response = new Response(recompressedBody, response);
19
+ }
20
+ return response;
21
+ };
22
+
23
23
  export default xfetch;
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
-
3
- /**
4
- * imports
5
- */
6
- import Fs from 'fs';
7
- import Path from 'path';
8
- import Layout from '../../config-pi/deployment/Layout.js';
9
-
10
- // ------------------------------------------
11
-
12
- const domain = process.env.CERTBOT_DOMAIN,
13
- validation = process.env.CERTBOT_VALIDATION,
14
- token = process.env.CERTBOT_TOKEN,
15
- remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
16
- allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
17
- ;
18
- (async function() {
19
- const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
20
- const acmeDir = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/');
21
- Fs.mkdirSync(acmeDir, {recursive:true});
22
- Fs.writeFileSync(Path.join(acmeDir, token), validation);
23
- })();
2
+
3
+ /**
4
+ * imports
5
+ */
6
+ import Fs from 'fs';
7
+ import Path from 'path';
8
+ import Layout from '../../config-pi/deployment/Layout.js';
9
+
10
+ // ------------------------------------------
11
+
12
+ const domain = process.env.CERTBOT_DOMAIN,
13
+ validation = process.env.CERTBOT_VALIDATION,
14
+ token = process.env.CERTBOT_TOKEN,
15
+ remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
16
+ allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
17
+ ;
18
+ (async function() {
19
+ const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
20
+ const acmeDir = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/');
21
+ Fs.mkdirSync(acmeDir, {recursive:true});
22
+ Fs.writeFileSync(Path.join(acmeDir, token), validation);
23
+ })();
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
-
3
- /**
4
- * imports
5
- */
6
- import Fs from 'fs';
7
- import Path from 'path';
8
- import Layout from '../../config-pi/deployment/Layout.js';
9
-
10
- // ------------------------------------------
11
-
12
- const domain = process.env.CERTBOT_DOMAIN,
13
- validation = process.env.CERTBOT_VALIDATION,
14
- token = process.env.CERTBOT_TOKEN,
15
- authOutput = process.env.CERTBOT_AUTH_OUTPUT,
16
- remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
17
- allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
18
- ;
19
- (async function() {
20
- const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
21
- const acmeFile = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/', token);
22
- Fs.unlinkSync(acmeFile);
23
- })();
2
+
3
+ /**
4
+ * imports
5
+ */
6
+ import Fs from 'fs';
7
+ import Path from 'path';
8
+ import Layout from '../../config-pi/deployment/Layout.js';
9
+
10
+ // ------------------------------------------
11
+
12
+ const domain = process.env.CERTBOT_DOMAIN,
13
+ validation = process.env.CERTBOT_VALIDATION,
14
+ token = process.env.CERTBOT_TOKEN,
15
+ authOutput = process.env.CERTBOT_AUTH_OUTPUT,
16
+ remainingChallenges = process.env.CERTBOT_REMAINING_CHALLENGES || 0/*,
17
+ allDomains = process.env.CERTBOT_ALL_DOMAINS.split(',')*/
18
+ ;
19
+ (async function() {
20
+ const layout = await (new Layout({ name: 'webflo', flags: {} })).read();
21
+ const acmeFile = Path.join(layout.PUBLIC_DIR, './.well-known/acme-challenge/', token);
22
+ Fs.unlinkSync(acmeFile);
23
+ })();