mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-01 12:21:25 +00:00
Build: ship Matrix crypto WASM pkg
This commit is contained in:
34
scripts/copy-matrix-crypto-wasm-pkg.mjs
Normal file
34
scripts/copy-matrix-crypto-wasm-pkg.mjs
Normal file
@@ -0,0 +1,34 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { removePathIfExists } from "./runtime-postbuild-shared.mjs";
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* cwd?: string;
|
||||
* repoRoot?: string;
|
||||
* }} [params]
|
||||
*/
|
||||
export function copyMatrixCryptoWasmPkg(params = {}) {
|
||||
const repoRoot = params.cwd ?? params.repoRoot ?? process.cwd();
|
||||
const sourcePkgDir = path.join(
|
||||
repoRoot,
|
||||
"node_modules",
|
||||
"@matrix-org",
|
||||
"matrix-sdk-crypto-wasm",
|
||||
"pkg",
|
||||
);
|
||||
const targetPkgDir = path.join(repoRoot, "dist", "pkg");
|
||||
|
||||
removePathIfExists(targetPkgDir);
|
||||
if (!fs.existsSync(sourcePkgDir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.mkdirSync(path.dirname(targetPkgDir), { recursive: true });
|
||||
fs.cpSync(sourcePkgDir, targetPkgDir, { force: true, recursive: true });
|
||||
}
|
||||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
||||
copyMatrixCryptoWasmPkg();
|
||||
}
|
||||
@@ -28,6 +28,7 @@ const requiredPathGroups = [
|
||||
"dist/build-info.json",
|
||||
"dist/channel-catalog.json",
|
||||
"dist/control-ui/index.html",
|
||||
"dist/pkg/matrix_sdk_crypto_wasm_bg.wasm",
|
||||
];
|
||||
const forbiddenPrefixes = ["dist-runtime/", "dist/OpenClaw.app/"];
|
||||
// 2026.3.12 ballooned to ~213.6 MiB unpacked and correlated with low-memory
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { copyBundledPluginMetadata } from "./copy-bundled-plugin-metadata.mjs";
|
||||
import { copyMatrixCryptoWasmPkg } from "./copy-matrix-crypto-wasm-pkg.mjs";
|
||||
import { copyPluginSdkRootAlias } from "./copy-plugin-sdk-root-alias.mjs";
|
||||
import { stageBundledPluginRuntimeDeps } from "./stage-bundled-plugin-runtime-deps.mjs";
|
||||
import { stageBundledPluginRuntime } from "./stage-bundled-plugin-runtime.mjs";
|
||||
@@ -8,6 +9,7 @@ import { writeOfficialChannelCatalog } from "./write-official-channel-catalog.mj
|
||||
export function runRuntimePostBuild(params = {}) {
|
||||
copyPluginSdkRootAlias(params);
|
||||
copyBundledPluginMetadata(params);
|
||||
copyMatrixCryptoWasmPkg(params);
|
||||
writeOfficialChannelCatalog(params);
|
||||
stageBundledPluginRuntimeDeps(params);
|
||||
stageBundledPluginRuntime(params);
|
||||
|
||||
Reference in New Issue
Block a user