mhx 2026.1.1 → 2026.1.3

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/mhx_ffi.js CHANGED
@@ -487,7 +487,8 @@ export function submit_event_has_submitter(event) {
487
487
  // ============================================================================
488
488
 
489
489
  export function fetch(url, optionsJson) {
490
- const options = JSON.parse(optionsJson);
490
+ const options =
491
+ typeof optionsJson === "string" ? JSON.parse(optionsJson) : optionsJson;
491
492
  return window.fetch(url, options);
492
493
  }
493
494
 
@@ -0,0 +1,26 @@
1
+ import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ const root = process.cwd();
5
+ const distDir = join(root, "dist");
6
+ const buildMain = join(root, "_build/js/release/build/main/main.js");
7
+ const buildFfi = join(root, "src/ffi/mhx_ffi.js");
8
+
9
+ mkdirSync(distDir, { recursive: true });
10
+
11
+ let mainJs = readFileSync(buildMain, "utf8");
12
+ const exportsBlock = `
13
+ export const init_mhx = f4ah6o$mhx$core$$init_mhx;
14
+ export const process = f4ah6o$mhx$core$$process;
15
+ export const handle_event = f4ah6o$mhx$core$$handle_event;
16
+ export const get_instance = f4ah6o$mhx$core$$get_instance;
17
+ export const version = f4ah6o$mhx$$version;
18
+ export const on_fetch_success = f4ah6o$mhx$network$$on_fetch_success;
19
+ export const on_fetch_error = f4ah6o$mhx$network$$on_fetch_error;
20
+ export const on_mutation_observed = f4ah6o$mhx$core$$on_mutation_observed;
21
+ `;
22
+ if (!mainJs.includes("export const init_mhx")) {
23
+ mainJs += `\n${exportsBlock}`;
24
+ }
25
+ writeFileSync(join(distDir, "index.js"), mainJs);
26
+ copyFileSync(buildFfi, join(distDir, "mhx_ffi.js"));
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "mhx",
3
- "version": "2026.1.1",
3
+ "version": "2026.1.3",
4
4
  "type": "module",
5
- "exports": "./npm/index.js",
5
+ "exports": {
6
+ ".": "./npm/index.js",
7
+ "./ffi": "./dist/mhx_ffi.js"
8
+ },
6
9
  "files": [
7
10
  "dist",
8
11
  "npm",
9
12
  "LICENSE",
10
- "README.mbt.md"
13
+ "README.md"
11
14
  ],
12
15
  "scripts": {
13
16
  "build:moon": "moon fmt && moon check && moon test && moon build --target js",
14
- "build": "pnpm build:moon && mkdir -p dist && cp _build/js/release/build/main/main.js dist/index.js && cp src/ffi/mhx_ffi.js dist/mhx_ffi.js"
17
+ "build": "pnpm build:moon && node npm/postbuild.mjs"
15
18
  },
16
19
  "license": "Apache-2.0",
17
20
  "repository": {