// The packager's native-target proof module (ADR 0049). Its backend uses sharp, a native dependency, // so it packages only for a native target. It is plain JavaScript and needs no build step. import { defineModuleRuntime } from "@ekklesia/module-sdk"; import sharp from "sharp"; /** A deterministic image operation: a 4×4 solid red image resized to 2×2, returned as raw pixels, * and the same image encoded as PNG and decoded again. */ export async function proof() { const resized = await sharp({ create: { background: { b: 0, g: 0, r: 255 }, channels: 3, height: 4, width: 4 }, }) .resize(2, 2) .raw() .toBuffer({ resolveWithObject: true }); const png = await sharp({ create: { background: { b: 255, g: 0, r: 0 }, channels: 3, height: 3, width: 5 }, }) .png() .toBuffer(); const decoded = await sharp(png).metadata(); return { pixels: [...resized.data], png: { format: decoded.format, height: decoded.height, width: decoded.width }, resized: { channels: resized.info.channels, height: resized.info.height, width: resized.info.width, }, }; } export default defineModuleRuntime({ database: { abi: 1 }, id: "native-proof", version: "0.1.0", register() {}, });