mhx 2026.1.16 → 2026.1.18

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.js CHANGED
@@ -9616,6 +9616,3 @@ function f4ah6o$mhx$core$$Mhx$init_mhx(self) {
9616
9616
  function f4ah6o$mhx$core$$init_mhx() {
9617
9617
  f4ah6o$mhx$core$$Mhx$init_mhx(f4ah6o$mhx$core$$global_mhx);
9618
9618
  }
9619
- (() => {
9620
- moonbitlang$async$$run_async_main((_cont, _err_cont) => new Result$Ok$16$(f4ah6o$mhx$core$$init_mhx()));
9621
- })();
package/dist/index.mjs CHANGED
@@ -9618,9 +9618,6 @@ function f4ah6o$mhx$core$$Mhx$init_mhx(self) {
9618
9618
  function f4ah6o$mhx$core$$init_mhx() {
9619
9619
  f4ah6o$mhx$core$$Mhx$init_mhx(f4ah6o$mhx$core$$global_mhx);
9620
9620
  }
9621
- (() => {
9622
- moonbitlang$async$$run_async_main((_cont, _err_cont) => new Result$Ok$16$(f4ah6o$mhx$core$$init_mhx()));
9623
- })();
9624
9621
 
9625
9622
 
9626
9623
  const process = (root) =>
@@ -9634,9 +9631,18 @@ const handle_event = (event, target) =>
9634
9631
  const get_instance = () => f4ah6o$mhx$core$$global_mhx;
9635
9632
 
9636
9633
 
9634
+ const mhx_callbacks = {
9635
+ on_fetch_success: f4ah6o$mhx$network$$on_fetch_success,
9636
+ on_fetch_error: f4ah6o$mhx$network$$on_fetch_error,
9637
+ on_mutation_observed: f4ah6o$mhx$core$$on_mutation_observed,
9638
+ };
9639
+ mhx_ffi.initMhxFfi(mhx_callbacks);
9640
+ globalThis.mhx_callbacks = mhx_callbacks;
9641
+
9642
+
9637
9643
  export const init_mhx = f4ah6o$mhx$core$$init_mhx;
9638
9644
  export { process, handle_event, get_instance };
9639
- export const version = "2026.1.16";
9645
+ export const version = "2026.1.18";
9640
9646
  export const on_fetch_success = f4ah6o$mhx$network$$on_fetch_success;
9641
9647
  export const on_fetch_error = f4ah6o$mhx$network$$on_fetch_error;
9642
9648
  export const on_mutation_observed = f4ah6o$mhx$core$$on_mutation_observed;
package/npm/postbuild.mjs CHANGED
@@ -16,7 +16,21 @@ mkdirSync(distDir, { recursive: true });
16
16
  const rawMainJs = readFileSync(buildMain, "utf8");
17
17
  const packageJson = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
18
18
  const packageVersion = String(packageJson.version ?? "0.0.0");
19
- let esmMainJs = rawMainJs;
19
+
20
+ const autorunRe =
21
+ /\(\(\)\s*=>\s*\{\s*moonbitlang\$async\$\$run_async_main\([\s\S]*?\);\s*\}\)\(\);\s*/;
22
+ const rawMainJsNoAutorun = rawMainJs.replace(autorunRe, "");
23
+
24
+ const ffiInitBlock = `
25
+ const mhx_callbacks = {
26
+ on_fetch_success: f4ah6o$mhx$network$$on_fetch_success,
27
+ on_fetch_error: f4ah6o$mhx$network$$on_fetch_error,
28
+ on_mutation_observed: f4ah6o$mhx$core$$on_mutation_observed,
29
+ };
30
+ mhx_ffi.initMhxFfi(mhx_callbacks);
31
+ globalThis.mhx_callbacks = mhx_callbacks;
32
+ `;
33
+ let esmMainJs = rawMainJsNoAutorun;
20
34
  const ffiHeader =
21
35
  'import mhxFfi from "./mhx_ffi.js";\nconst mhx_ffi = mhxFfi;\n';
22
36
  const stableExports = `
@@ -45,9 +59,12 @@ const hasStableExports = esmMainJs.includes("const process = (root) =>");
45
59
  if (!hasStableExports) {
46
60
  esmMainJs += `\n${stableExports}`;
47
61
  }
62
+ if (!esmMainJs.includes("mhx_ffi.initMhxFfi")) {
63
+ esmMainJs += `\n${ffiInitBlock}`;
64
+ }
48
65
  if (!esmMainJs.includes("export const init_mhx")) {
49
66
  esmMainJs += `\n${exportsBlock}`;
50
67
  }
51
- writeFileSync(join(distDir, "index.js"), rawMainJs);
68
+ writeFileSync(join(distDir, "index.js"), rawMainJsNoAutorun);
52
69
  writeFileSync(join(distDir, "index.mjs"), esmMainJs);
53
70
  copyFileSync(buildFfi, join(distDir, "mhx_ffi.js"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mhx",
3
- "version": "2026.1.16",
3
+ "version": "2026.1.18",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./npm/index.js",