@hypen-space/core 0.4.24 → 0.4.26
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/dist/app.js +1 -16
- package/dist/app.js.map +2 -2
- package/dist/components/builtin.js +1 -16
- package/dist/components/builtin.js.map +2 -2
- package/dist/context.js +1 -16
- package/dist/context.js.map +2 -2
- package/dist/discovery.js +1 -16
- package/dist/discovery.js.map +2 -2
- package/dist/disposable.js +1 -16
- package/dist/disposable.js.map +2 -2
- package/dist/engine.browser.js +1 -16
- package/dist/engine.browser.js.map +2 -2
- package/dist/engine.js +1 -16
- package/dist/engine.js.map +2 -2
- package/dist/events.js +1 -16
- package/dist/events.js.map +2 -2
- package/dist/index.browser.js +1 -16
- package/dist/index.browser.js.map +2 -2
- package/dist/index.js +1 -16
- package/dist/index.js.map +2 -2
- package/dist/loader.js +1 -16
- package/dist/loader.js.map +2 -2
- package/dist/logger.js +1 -16
- package/dist/logger.js.map +2 -2
- package/dist/plugin.js +4 -19
- package/dist/plugin.js.map +3 -3
- package/dist/remote/client.js +1 -16
- package/dist/remote/client.js.map +2 -2
- package/dist/remote/index.js +37 -19
- package/dist/remote/index.js.map +4 -4
- package/dist/remote/server.d.ts +15 -0
- package/dist/remote/server.js +37 -19
- package/dist/remote/server.js.map +4 -4
- package/dist/renderer.js +1 -16
- package/dist/renderer.js.map +2 -2
- package/dist/resolver.js +4 -19
- package/dist/resolver.js.map +3 -3
- package/dist/router.js +1 -16
- package/dist/router.js.map +2 -2
- package/dist/state.js +1 -16
- package/dist/state.js.map +2 -2
- package/package.json +1 -1
- package/src/remote/server.ts +54 -0
- package/wasm-browser/hypen_engine_bg.wasm +0 -0
- package/wasm-browser/package.json +1 -1
- package/wasm-node/hypen_engine_bg.wasm +0 -0
- package/wasm-node/package.json +1 -1
package/dist/remote/server.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare class RemoteServer {
|
|
|
46
46
|
private nextClientId;
|
|
47
47
|
private server;
|
|
48
48
|
private sessionManager;
|
|
49
|
+
private _syncActions;
|
|
49
50
|
/**
|
|
50
51
|
* Set the module for this app
|
|
51
52
|
*/
|
|
@@ -78,6 +79,12 @@ export declare class RemoteServer {
|
|
|
78
79
|
* Configure session management
|
|
79
80
|
*/
|
|
80
81
|
session(config: SessionConfig): this;
|
|
82
|
+
/**
|
|
83
|
+
* Enable action synchronization across all connected clients.
|
|
84
|
+
* When enabled, an action dispatched by any client is also dispatched
|
|
85
|
+
* to every other client's engine, keeping all clients in sync.
|
|
86
|
+
*/
|
|
87
|
+
syncActions(): this;
|
|
81
88
|
/**
|
|
82
89
|
* Register connection callback
|
|
83
90
|
*/
|
|
@@ -140,6 +147,14 @@ export declare class RemoteServer {
|
|
|
140
147
|
* Handle WebSocket close - suspend session instead of destroying
|
|
141
148
|
*/
|
|
142
149
|
private handleClose;
|
|
150
|
+
/**
|
|
151
|
+
* Reload components from the source directory and re-render all connected clients.
|
|
152
|
+
* Call this when source files change to implement hot reload.
|
|
153
|
+
*
|
|
154
|
+
* The engine's reconciler diffs the old tree against the new one, producing
|
|
155
|
+
* minimal patches (Create/Remove/SetProp) that are streamed to clients.
|
|
156
|
+
*/
|
|
157
|
+
reload(): Promise<void>;
|
|
143
158
|
/**
|
|
144
159
|
* Get current client count
|
|
145
160
|
*/
|
package/dist/remote/server.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
7
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
8
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
|
-
for (let key of __getOwnPropNames(mod))
|
|
10
|
-
if (!__hasOwnProp.call(to, key))
|
|
11
|
-
__defProp(to, key, {
|
|
12
|
-
get: () => mod[key],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
2
|
var __export = (target, all) => {
|
|
18
3
|
for (var name in all)
|
|
19
4
|
__defProp(target, name, {
|
|
@@ -891,7 +876,7 @@ __export(exports_path, {
|
|
|
891
876
|
});
|
|
892
877
|
function assertPath(path) {
|
|
893
878
|
if (typeof path !== "string")
|
|
894
|
-
throw
|
|
879
|
+
throw TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
895
880
|
}
|
|
896
881
|
function normalizeStringPosix(path, allowAboveRoot) {
|
|
897
882
|
var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
|
|
@@ -1081,7 +1066,7 @@ function dirname(path) {
|
|
|
1081
1066
|
}
|
|
1082
1067
|
function basename(path, ext) {
|
|
1083
1068
|
if (ext !== undefined && typeof ext !== "string")
|
|
1084
|
-
throw
|
|
1069
|
+
throw TypeError('"ext" argument must be a string');
|
|
1085
1070
|
assertPath(path);
|
|
1086
1071
|
var start = 0, end = -1, matchedSlash = true, i;
|
|
1087
1072
|
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
@@ -1153,7 +1138,7 @@ function extname(path) {
|
|
|
1153
1138
|
}
|
|
1154
1139
|
function format(pathObject) {
|
|
1155
1140
|
if (pathObject === null || typeof pathObject !== "object")
|
|
1156
|
-
throw
|
|
1141
|
+
throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
1157
1142
|
return _format("/", pathObject);
|
|
1158
1143
|
}
|
|
1159
1144
|
function parse(path) {
|
|
@@ -1652,6 +1637,7 @@ class RemoteServer {
|
|
|
1652
1637
|
nextClientId = 1;
|
|
1653
1638
|
server = null;
|
|
1654
1639
|
sessionManager = null;
|
|
1640
|
+
_syncActions = false;
|
|
1655
1641
|
module(name, module) {
|
|
1656
1642
|
this._moduleName = name;
|
|
1657
1643
|
this._module = module;
|
|
@@ -1673,6 +1659,10 @@ class RemoteServer {
|
|
|
1673
1659
|
this._sessionConfig = config2;
|
|
1674
1660
|
return this;
|
|
1675
1661
|
}
|
|
1662
|
+
syncActions() {
|
|
1663
|
+
this._syncActions = true;
|
|
1664
|
+
return this;
|
|
1665
|
+
}
|
|
1676
1666
|
onConnection(callback) {
|
|
1677
1667
|
this._onConnectionCallbacks.push(callback);
|
|
1678
1668
|
return this;
|
|
@@ -1975,6 +1965,13 @@ class RemoteServer {
|
|
|
1975
1965
|
case "dispatchAction": {
|
|
1976
1966
|
const actionMsg = msg;
|
|
1977
1967
|
clientData.engine.dispatchAction(actionMsg.action, actionMsg.payload);
|
|
1968
|
+
if (this._syncActions) {
|
|
1969
|
+
for (const [otherWs, otherClient] of this.clients) {
|
|
1970
|
+
if (otherWs === ws || !otherClient.helloReceived)
|
|
1971
|
+
continue;
|
|
1972
|
+
otherClient.engine.dispatchAction(actionMsg.action, actionMsg.payload);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1978
1975
|
break;
|
|
1979
1976
|
}
|
|
1980
1977
|
default:
|
|
@@ -2023,6 +2020,27 @@ class RemoteServer {
|
|
|
2023
2020
|
};
|
|
2024
2021
|
this._onDisconnectionCallbacks.forEach((cb) => cb(client));
|
|
2025
2022
|
}
|
|
2023
|
+
async reload() {
|
|
2024
|
+
if (this._sourceDir) {
|
|
2025
|
+
this._ui = "";
|
|
2026
|
+
await this.discoverFromSource();
|
|
2027
|
+
}
|
|
2028
|
+
if (!this._ui) {
|
|
2029
|
+
log4.warn("Reload skipped: no UI template available");
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
for (const [ws, clientData] of this.clients) {
|
|
2033
|
+
if (!clientData.helloReceived)
|
|
2034
|
+
continue;
|
|
2035
|
+
this.setupComponentResolver(clientData.engine);
|
|
2036
|
+
try {
|
|
2037
|
+
clientData.engine.renderSource(this._ui);
|
|
2038
|
+
log4.info(`Hot-reloaded client ${clientData.id}`);
|
|
2039
|
+
} catch (e) {
|
|
2040
|
+
log4.error(`Failed to hot-reload client ${clientData.id}:`, e);
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2026
2044
|
getClientCount() {
|
|
2027
2045
|
return this.clients.size;
|
|
2028
2046
|
}
|
|
@@ -2070,4 +2088,4 @@ export {
|
|
|
2070
2088
|
RemoteServer
|
|
2071
2089
|
};
|
|
2072
2090
|
|
|
2073
|
-
//# debugId=
|
|
2091
|
+
//# debugId=258422296EF2F70264756E2164756E21
|