Matrix: cover crypto runtime require boundary

This commit is contained in:
Gustavo Madeira Santana 2026-03-28 17:34:01 -04:00
parent 6f98ee7f62
commit 61d99628f9
No known key found for this signature in database
2 changed files with 28 additions and 0 deletions

View File

@ -127,6 +127,7 @@ Docs: https://docs.openclaw.ai
- Daemon/status: surface immediate gateway close reasons from lightweight probes and prefer those concrete auth or pairing failures over generic timeouts in `openclaw daemon status`. (#56282) Thanks @mbelinky.
- Agents/failover: classify HTTP 410 errors as retryable timeouts by default while still preserving explicit session-expired, billing, and auth signals from the payload. (#55201) thanks @nikus-pan.
- Agents/subagents: restore completion announce delivery for extension channels like BlueBubbles. (#56348)
- Plugins/Matrix: load bundled `@matrix-org/matrix-sdk-crypto-nodejs` through `createRequire(...)` so E2EE media send and receive keep the package-local native binding lookup working in packaged ESM builds. (#54566) thanks @joelnishanth.
## 2026.3.24

View File

@ -0,0 +1,27 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import { build } from "esbuild";
import { describe, expect, it } from "vitest";
const sdkDir = path.dirname(fileURLToPath(import.meta.url));
const cryptoNodeRuntimePath = path.join(sdkDir, "crypto-node.runtime.ts");
describe("crypto-node runtime bundling", () => {
it("keeps the native Matrix crypto package behind a runtime require boundary", async () => {
const result = await build({
entryPoints: [cryptoNodeRuntimePath],
bundle: true,
external: ["@matrix-org/matrix-sdk-crypto-nodejs"],
format: "esm",
platform: "node",
write: false,
});
const bundled = result.outputFiles.at(0)?.text ?? "";
expect(bundled).toContain('from "node:module"');
expect(bundled).toContain("createRequire(import.meta.url)");
expect(bundled).toMatch(/require\d*\("@matrix-org\/matrix-sdk-crypto-nodejs"\)/);
expect(bundled).not.toContain('from "@matrix-org/matrix-sdk-crypto-nodejs"');
});
});