mhx 2026.1.13 → 2026.1.15
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 +7992 -4
- package/npm/postbuild.mjs +16 -7
- package/package.json +1 -1
package/npm/postbuild.mjs
CHANGED
|
@@ -12,23 +12,32 @@ const rawMainJs = readFileSync(buildMain, "utf8");
|
|
|
12
12
|
let esmMainJs = rawMainJs;
|
|
13
13
|
const ffiHeader =
|
|
14
14
|
'import mhxFfi from "./mhx_ffi.js";\nconst mhx_ffi = mhxFfi;\n';
|
|
15
|
+
const stableExports = `
|
|
16
|
+
const process = (root) =>
|
|
17
|
+
f4ah6o$mhx$core$$Mhx$process_tree(f4ah6o$mhx$core$$global_mhx, root);
|
|
18
|
+
const handle_event = (event, target) =>
|
|
19
|
+
f4ah6o$mhx$core$$Mhx$handle_event(
|
|
20
|
+
f4ah6o$mhx$core$$global_mhx,
|
|
21
|
+
event,
|
|
22
|
+
target,
|
|
23
|
+
);
|
|
24
|
+
const get_instance = () => f4ah6o$mhx$core$$global_mhx;
|
|
25
|
+
`;
|
|
15
26
|
if (!esmMainJs.startsWith('import mhxFfi from "./mhx_ffi.js";')) {
|
|
16
27
|
esmMainJs = ffiHeader + esmMainJs;
|
|
17
28
|
}
|
|
18
|
-
esmMainJs = esmMainJs.replace(
|
|
19
|
-
/\(\(\)\s*=>\s*\{[\s\S]*?moonbitlang\$async\$\$run_async_main[\s\S]*?\}\)\(\);/g,
|
|
20
|
-
"",
|
|
21
|
-
);
|
|
22
29
|
const exportsBlock = `
|
|
23
30
|
export const init_mhx = f4ah6o$mhx$core$$init_mhx;
|
|
24
|
-
export
|
|
25
|
-
export const handle_event = f4ah6o$mhx$core$$handle_event;
|
|
26
|
-
export const get_instance = f4ah6o$mhx$core$$get_instance;
|
|
31
|
+
export { process, handle_event, get_instance };
|
|
27
32
|
export const version = f4ah6o$mhx$$version;
|
|
28
33
|
export const on_fetch_success = f4ah6o$mhx$network$$on_fetch_success;
|
|
29
34
|
export const on_fetch_error = f4ah6o$mhx$network$$on_fetch_error;
|
|
30
35
|
export const on_mutation_observed = f4ah6o$mhx$core$$on_mutation_observed;
|
|
31
36
|
`;
|
|
37
|
+
const hasStableExports = esmMainJs.includes("const process = (root) =>");
|
|
38
|
+
if (!hasStableExports) {
|
|
39
|
+
esmMainJs += `\n${stableExports}`;
|
|
40
|
+
}
|
|
32
41
|
if (!esmMainJs.includes("export const init_mhx")) {
|
|
33
42
|
esmMainJs += `\n${exportsBlock}`;
|
|
34
43
|
}
|