mhx 2026.1.18 → 2026.1.19

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/index.mjs CHANGED
@@ -9642,7 +9642,7 @@ globalThis.mhx_callbacks = mhx_callbacks;
9642
9642
 
9643
9643
  export const init_mhx = f4ah6o$mhx$core$$init_mhx;
9644
9644
  export { process, handle_event, get_instance };
9645
- export const version = "2026.1.18";
9645
+ export const version = "2026.1.19";
9646
9646
  export const on_fetch_success = f4ah6o$mhx$network$$on_fetch_success;
9647
9647
  export const on_fetch_error = f4ah6o$mhx$network$$on_fetch_error;
9648
9648
  export const on_mutation_observed = f4ah6o$mhx$core$$on_mutation_observed;
package/dist/mhx_ffi.js CHANGED
@@ -802,7 +802,7 @@ export function current_time() {
802
802
  // Export all FFI functions as a module
803
803
  // ============================================================================
804
804
 
805
- export default {
805
+ const mhx_ffi = {
806
806
  initMhxFfi,
807
807
  // Document/Window
808
808
  get_document,
@@ -961,3 +961,69 @@ export default {
961
961
  // Timing
962
962
  current_time,
963
963
  };
964
+
965
+ export default mhx_ffi;
966
+
967
+ if (typeof globalThis !== "undefined" && !globalThis.mhx_ffi) {
968
+ globalThis.mhx_ffi = mhx_ffi;
969
+ }
970
+
971
+ function build_process_from_global(g) {
972
+ if (g.f4ah6o$mhx$core$$process) {
973
+ return g.f4ah6o$mhx$core$$process;
974
+ }
975
+ if (g.f4ah6o$mhx$core$$Mhx$process_tree && g.f4ah6o$mhx$core$$global_mhx) {
976
+ return (root) =>
977
+ g.f4ah6o$mhx$core$$Mhx$process_tree(g.f4ah6o$mhx$core$$global_mhx, root);
978
+ }
979
+ return null;
980
+ }
981
+
982
+ function try_register_from_global() {
983
+ if (mbtModule !== null && globalThis.mhx) {
984
+ return true;
985
+ }
986
+ const g = globalThis;
987
+ const init = g.f4ah6o$mhx$core$$init_mhx;
988
+ const handle = g.f4ah6o$mhx$core$$handle_event;
989
+ const onFetchOk = g.f4ah6o$mhx$network$$on_fetch_success;
990
+ const onFetchErr = g.f4ah6o$mhx$network$$on_fetch_error;
991
+ const onMutation = g.f4ah6o$mhx$core$$on_mutation_observed;
992
+ const process = build_process_from_global(g);
993
+ if (init && handle && onFetchOk && onFetchErr && onMutation && process) {
994
+ const version =
995
+ g.f4ah6o$mhx$$version || g.f4ah6o$mhx$core$$version || "unknown";
996
+ register_exports(
997
+ init,
998
+ process,
999
+ handle,
1000
+ version,
1001
+ onFetchOk,
1002
+ onFetchErr,
1003
+ onMutation
1004
+ );
1005
+ return true;
1006
+ }
1007
+ return false;
1008
+ }
1009
+
1010
+ function auto_register_exports() {
1011
+ if (try_register_from_global()) {
1012
+ return;
1013
+ }
1014
+ if (typeof setTimeout !== "function") {
1015
+ return;
1016
+ }
1017
+ let attempts = 0;
1018
+ const maxAttempts = 50;
1019
+ const retry = () => {
1020
+ attempts += 1;
1021
+ if (try_register_from_global() || attempts >= maxAttempts) {
1022
+ return;
1023
+ }
1024
+ setTimeout(retry, 0);
1025
+ };
1026
+ setTimeout(retry, 0);
1027
+ }
1028
+
1029
+ auto_register_exports();
@@ -0,0 +1,31 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ const root = process.cwd();
5
+ const distIndex = join(root, "dist", "index.mjs");
6
+
7
+ const content = readFileSync(distIndex, "utf8");
8
+
9
+ const mustInclude = [
10
+ "mhx_ffi.initMhxFfi",
11
+ "export const init_mhx",
12
+ "export { process, handle_event, get_instance }",
13
+ ];
14
+
15
+ for (const needle of mustInclude) {
16
+ if (!content.includes(needle)) {
17
+ throw new Error(`dist/index.mjs missing: ${needle}`);
18
+ }
19
+ }
20
+
21
+ const mustNotInclude = [
22
+ "run_async_main((_cont",
23
+ ];
24
+
25
+ for (const needle of mustNotInclude) {
26
+ if (content.includes(needle)) {
27
+ throw new Error(`dist/index.mjs should not include: ${needle}`);
28
+ }
29
+ }
30
+
31
+ console.log("dist/index.mjs verified");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mhx",
3
- "version": "2026.1.18",
3
+ "version": "2026.1.19",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./npm/index.js",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "build:moon": "moon fmt && moon check && moon test && moon build --target js",
17
- "build": "pnpm build:moon && node npm/postbuild.mjs"
17
+ "build": "pnpm build:moon && node npm/postbuild.mjs && node npm/verify-dist.mjs"
18
18
  },
19
19
  "license": "Apache-2.0",
20
20
  "repository": {