@olares/lares-core 0.15.4 → 0.15.5
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/larepass/host.js +17 -0
- package/package.json +1 -1
package/larepass/host.js
CHANGED
|
@@ -45,6 +45,23 @@ export function hostConfigFromEnv(env = {}) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Every key the host may hand down. The list is canonical: a host spreads these
|
|
50
|
+
* onto the components as props and `createHostClient` reads them back off the
|
|
51
|
+
* object, so a key that exists in one place and not the other is dropped in
|
|
52
|
+
* silence — which is how `socketProtocol` shipped inert once already.
|
|
53
|
+
*/
|
|
54
|
+
export const HOST_PORT_KEYS = ["baseUrl", "proxyPrefix", "env", "request", "socketProtocol"];
|
|
55
|
+
|
|
56
|
+
/** Collect the port keys off any carrier (a component instance included). */
|
|
57
|
+
export function pickHostPorts(source = {}) {
|
|
58
|
+
const ports = {};
|
|
59
|
+
for (const key of HOST_PORT_KEYS) {
|
|
60
|
+
ports[key] = source[key];
|
|
61
|
+
}
|
|
62
|
+
return ports;
|
|
63
|
+
}
|
|
64
|
+
|
|
48
65
|
/** Resolve the live Host origin. Explicit baseUrl/proxyPrefix win over env. */
|
|
49
66
|
export function hostTarget(ports = {}) {
|
|
50
67
|
const fromEnv = hostConfigFromEnv(ports.env);
|