@hypen-space/core 0.4.24 → 0.4.25

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 (47) hide show
  1. package/dist/app.js +1 -16
  2. package/dist/app.js.map +2 -2
  3. package/dist/components/builtin.js +1 -16
  4. package/dist/components/builtin.js.map +2 -2
  5. package/dist/context.js +1 -16
  6. package/dist/context.js.map +2 -2
  7. package/dist/discovery.js +1 -16
  8. package/dist/discovery.js.map +2 -2
  9. package/dist/disposable.js +1 -16
  10. package/dist/disposable.js.map +2 -2
  11. package/dist/engine.browser.js +1 -16
  12. package/dist/engine.browser.js.map +2 -2
  13. package/dist/engine.js +1 -16
  14. package/dist/engine.js.map +2 -2
  15. package/dist/events.js +1 -16
  16. package/dist/events.js.map +2 -2
  17. package/dist/index.browser.js +1 -16
  18. package/dist/index.browser.js.map +2 -2
  19. package/dist/index.js +1 -16
  20. package/dist/index.js.map +2 -2
  21. package/dist/loader.js +1 -16
  22. package/dist/loader.js.map +2 -2
  23. package/dist/logger.js +1 -16
  24. package/dist/logger.js.map +2 -2
  25. package/dist/plugin.js +4 -19
  26. package/dist/plugin.js.map +3 -3
  27. package/dist/remote/client.js +1 -16
  28. package/dist/remote/client.js.map +2 -2
  29. package/dist/remote/index.js +25 -19
  30. package/dist/remote/index.js.map +4 -4
  31. package/dist/remote/server.d.ts +8 -0
  32. package/dist/remote/server.js +25 -19
  33. package/dist/remote/server.js.map +4 -4
  34. package/dist/renderer.js +1 -16
  35. package/dist/renderer.js.map +2 -2
  36. package/dist/resolver.js +4 -19
  37. package/dist/resolver.js.map +3 -3
  38. package/dist/router.js +1 -16
  39. package/dist/router.js.map +2 -2
  40. package/dist/state.js +1 -16
  41. package/dist/state.js.map +2 -2
  42. package/package.json +1 -1
  43. package/src/remote/server.ts +35 -0
  44. package/wasm-browser/hypen_engine_bg.wasm +0 -0
  45. package/wasm-browser/package.json +1 -1
  46. package/wasm-node/hypen_engine_bg.wasm +0 -0
  47. package/wasm-node/package.json +1 -1
@@ -140,6 +140,14 @@ export declare class RemoteServer {
140
140
  * Handle WebSocket close - suspend session instead of destroying
141
141
  */
142
142
  private handleClose;
143
+ /**
144
+ * Reload components from the source directory and re-render all connected clients.
145
+ * Call this when source files change to implement hot reload.
146
+ *
147
+ * The engine's reconciler diffs the old tree against the new one, producing
148
+ * minimal patches (Create/Remove/SetProp) that are streamed to clients.
149
+ */
150
+ reload(): Promise<void>;
143
151
  /**
144
152
  * Get current client count
145
153
  */
@@ -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 new TypeError("Path must be a string. Received " + JSON.stringify(path));
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 new TypeError('"ext" argument must be a string');
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 new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
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) {
@@ -2023,6 +2008,27 @@ class RemoteServer {
2023
2008
  };
2024
2009
  this._onDisconnectionCallbacks.forEach((cb) => cb(client));
2025
2010
  }
2011
+ async reload() {
2012
+ if (this._sourceDir) {
2013
+ this._ui = "";
2014
+ await this.discoverFromSource();
2015
+ }
2016
+ if (!this._ui) {
2017
+ log4.warn("Reload skipped: no UI template available");
2018
+ return;
2019
+ }
2020
+ for (const [ws, clientData] of this.clients) {
2021
+ if (!clientData.helloReceived)
2022
+ continue;
2023
+ this.setupComponentResolver(clientData.engine);
2024
+ try {
2025
+ clientData.engine.renderSource(this._ui);
2026
+ log4.info(`Hot-reloaded client ${clientData.id}`);
2027
+ } catch (e) {
2028
+ log4.error(`Failed to hot-reload client ${clientData.id}:`, e);
2029
+ }
2030
+ }
2031
+ }
2026
2032
  getClientCount() {
2027
2033
  return this.clients.size;
2028
2034
  }
@@ -2070,4 +2076,4 @@ export {
2070
2076
  RemoteServer
2071
2077
  };
2072
2078
 
2073
- //# debugId=EB14C82B43F72D2C64756E2164756E21
2079
+ //# debugId=204F87CAD3EAB92064756E2164756E21