mhx 2026.1.3 → 2026.1.5
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/npm/index.js +9 -6
- package/npm/postbuild.mjs +8 -0
- package/package.json +1 -1
package/npm/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as mhx from "../dist/index.js";
|
|
2
|
-
import
|
|
2
|
+
import * as mhxFfi from "../dist/mhx_ffi.js";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
globalThis.mhx_ffi = mhxFfi;
|
|
5
|
+
if (mhxFfi.initMhxFfi) {
|
|
6
|
+
mhxFfi.initMhxFfi({
|
|
7
|
+
on_fetch_success: mhx.on_fetch_success,
|
|
8
|
+
on_fetch_error: mhx.on_fetch_error,
|
|
9
|
+
on_mutation_observed: mhx.on_mutation_observed,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
export const init_mhx = mhx.init_mhx;
|
|
11
14
|
export const process = mhx.process;
|
package/npm/postbuild.mjs
CHANGED
|
@@ -9,6 +9,14 @@ const buildFfi = join(root, "src/ffi/mhx_ffi.js");
|
|
|
9
9
|
mkdirSync(distDir, { recursive: true });
|
|
10
10
|
|
|
11
11
|
let mainJs = readFileSync(buildMain, "utf8");
|
|
12
|
+
const autoRunIdx = mainJs.lastIndexOf("moonbitlang$async$$run_async_main");
|
|
13
|
+
if (autoRunIdx !== -1) {
|
|
14
|
+
const start = mainJs.lastIndexOf("(() =>", autoRunIdx);
|
|
15
|
+
const end = mainJs.indexOf("})();", autoRunIdx);
|
|
16
|
+
if (start !== -1 && end !== -1) {
|
|
17
|
+
mainJs = mainJs.slice(0, start) + mainJs.slice(end + 5);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
12
20
|
const exportsBlock = `
|
|
13
21
|
export const init_mhx = f4ah6o$mhx$core$$init_mhx;
|
|
14
22
|
export const process = f4ah6o$mhx$core$$process;
|