// Focused check 2: unsupported format recorded as blocker, not success. // Verifies the honest boundary of what @signalapp/libsignal-client provides for // a Web (browser/worker) deployment and for the OMEMO/OMEMO2 wire format. // This script deliberately does NOT claim success for anything it cannot show. import { existsSync, readdirSync, statSync } from 'node:fs'; import { join, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; const here = dirname(fileURLToPath(import.meta.url)); const pkgDir = join(here, '..', 'node_modules', '@signalapp', 'libsignal-client'); function walkWasm(dir, acc = []) { for (const e of readdirSync(dir)) { const p = join(dir, e); if (statSync(p).isDirectory()) walkWasm(p, acc); else if (e.endsWith('.wasm')) acc.push(p); } return acc; } const wasmFiles = existsSync(pkgDir) ? walkWasm(pkgDir) : null; const prebuildDir = join(pkgDir, 'prebuilds'); const prebuilds = existsSync(prebuildDir) ? readdirSync(prebuildDir) : []; console.log('pkgPresent:', existsSync(pkgDir)); console.log('wasmFiles:', wasmFiles ? wasmFiles.length : 'n/a'); console.log('prebuilds:', prebuilds.join(', ')); if (!wasmFiles || wasmFiles.length === 0) { // This is an unsupported backend for a browser worker, not a success. const msg = 'UNSUPPORTED_BLOCKER: no .wasm asset ships in @signalapp/libsignal-client; ' + 'the distribution is a Node native addon (prebuilds/*/*.node). A browser ' + 'worker/WASM deployment is NOT established by this npm package and must be ' + 'treated as a blocker until a verified browser/WASM distribution is found.'; console.log(msg); process.exit(2); } else { console.log('wasm present (unexpected here)'); process.exit(0); }