mhx 2026.1.10 → 2026.1.12
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 +7980 -13
- package/dist/index.mjs +1654 -0
- package/npm/index.js +1 -1
- package/npm/postbuild.mjs +11 -8
- package/package.json +1 -1
package/npm/index.js
CHANGED
package/npm/postbuild.mjs
CHANGED
|
@@ -8,12 +8,14 @@ const buildFfi = join(root, "src/ffi/mhx_ffi.js");
|
|
|
8
8
|
|
|
9
9
|
mkdirSync(distDir, { recursive: true });
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const rawMainJs = readFileSync(buildMain, "utf8");
|
|
12
|
+
let esmMainJs = rawMainJs;
|
|
13
|
+
const ffiHeader =
|
|
14
|
+
'import mhxFfi from "./mhx_ffi.js";\nconst mhx_ffi = mhxFfi;\n';
|
|
15
|
+
if (!esmMainJs.startsWith('import mhxFfi from "./mhx_ffi.js";')) {
|
|
16
|
+
esmMainJs = ffiHeader + esmMainJs;
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
esmMainJs = esmMainJs.replace(
|
|
17
19
|
/\(\(\)\s*=>\s*\{[\s\S]*?moonbitlang\$async\$\$run_async_main[\s\S]*?\}\)\(\);/g,
|
|
18
20
|
"",
|
|
19
21
|
);
|
|
@@ -27,8 +29,9 @@ export const on_fetch_success = f4ah6o$mhx$network$$on_fetch_success;
|
|
|
27
29
|
export const on_fetch_error = f4ah6o$mhx$network$$on_fetch_error;
|
|
28
30
|
export const on_mutation_observed = f4ah6o$mhx$core$$on_mutation_observed;
|
|
29
31
|
`;
|
|
30
|
-
if (!
|
|
31
|
-
|
|
32
|
+
if (!esmMainJs.includes("export const init_mhx")) {
|
|
33
|
+
esmMainJs += `\n${exportsBlock}`;
|
|
32
34
|
}
|
|
33
|
-
writeFileSync(join(distDir, "index.js"),
|
|
35
|
+
writeFileSync(join(distDir, "index.js"), rawMainJs);
|
|
36
|
+
writeFileSync(join(distDir, "index.mjs"), esmMainJs);
|
|
34
37
|
copyFileSync(buildFfi, join(distDir, "mhx_ffi.js"));
|