Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.7 KiB
getJavyBinary — @suaveplan/javy-cli-win32-x64
Purpose
This module exposes the absolute filesystem path to the platform-specific Javy v8.1.1 binary bundled with this wrapper package. The Javy CLI is a Bytecode-Alliance project that compiles JavaScript source files into self-contained WebAssembly modules; @suaveplan/wasm-compiler-javy consumes getJavyBinary() to locate the binary it spawns via child_process.spawnSync, eliminating the need for consumers to ship their own download or PATH lookup.
The wrapper carries matching os + cpu constraints in package.json so npm/bun skip installation on mismatched platforms — this means a single monorepo install stays cross-platform-safe, and the compiler can iterate its optionalDependencies to find whichever wrapper actually installed.
Features
getJavyBinary()— returns the absolute path to the platform binary, throwing a structuredErrorif the postinstall download failed or was bypassed.JAVY_PLATFORM— the platform triple this wrapper serves (win32-x64).JAVY_VERSION— the pinned Javy upstream version (v8.1.1).
Usage: Basic
import { getJavyBinary } from "@suaveplan/javy-cli-win32-x64";
const javy = getJavyBinary();
// javy === "/abs/path/to/bin/javy.exe"
Usage: Advanced
import { getJavyBinary, JAVY_PLATFORM, JAVY_VERSION } from "@suaveplan/javy-cli-win32-x64";
import { spawnSync } from "node:child_process";
if (JAVY_PLATFORM !== `${process.platform}-${process.arch}`) {
throw new Error("wrong wrapper");
}
const result = spawnSync(getJavyBinary(), ["build", "src.js", "-o", "out.wasm", "-C", "deterministic=y"], {
encoding: "utf8",
});
console.log("javy version:", JAVY_VERSION, "exit:", result.status);
API Reference
getJavyBinary(): string— resolves the bundled binary path. ThrowsErrorwhen the binary is absent.JAVY_PLATFORM: "win32-x64"— readonly string literal.JAVY_VERSION: "v8.1.1"— readonly string literal.
Implementation Notes
The binary is downloaded at install time by postinstall.mjs from github.com/bytecodealliance/javy/releases/download/v8.1.1/javy-x86_64-windows-v8.1.1.gz with a committed SHA-256 checksum verifying the gzip payload before decompression. The decompressed binary is chmod-ed to 0o755 (no-op on Windows) and placed at bin/javy.exe relative to the package root. The committed sha for this wrapper is 0bf92caffa34d4b41394c6f5aa88a535c8982ed2793662ff3de6df0a9e5f8953. JAVY_SKIP_DOWNLOAD=1 skips the download for offline CI sandboxes — callers MUST seed bin/javy.exe themselves in that mode. The wrapper is intentionally tiny: a path string and two constants, no logic beyond fs.existsSync.