first commit
This commit is contained in:
9
docs/devtools/tooling/javy-cli-darwin-arm64/README.md
Normal file
9
docs/devtools/tooling/javy-cli-darwin-arm64/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# @suaveplan/javy-cli-darwin-arm64
|
||||
|
||||
Platform wrapper for **Javy v8.1.1** on `darwin-arm64`.
|
||||
|
||||
Downloads the Javy CLI binary from `github.com/bytecodealliance/javy/releases` at install time with SHA-256 checksum verification (`0ae154f026371aae1e82fb39381fd58e67ca6b2a2985fbce51d305b138dad59f`), and exposes a `getJavyBinary(): string` helper returning the absolute path to the bundled binary.
|
||||
|
||||
Consumed exclusively by `@suaveplan/wasm-compiler-javy` through `optionalDependencies` — npm/bun skip installation of mismatched-platform wrappers so a single monorepo install stays cross-platform-safe.
|
||||
|
||||
Set `JAVY_SKIP_DOWNLOAD=1` to skip the download for offline CI sandboxes; you MUST seed `bin/javy` yourself in that mode.
|
||||
47
docs/devtools/tooling/javy-cli-darwin-arm64/src/index.md
Normal file
47
docs/devtools/tooling/javy-cli-darwin-arm64/src/index.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# `getJavyBinary` — @suaveplan/javy-cli-darwin-arm64
|
||||
|
||||
## 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 structured `Error` if the postinstall download failed or was bypassed.
|
||||
- `JAVY_PLATFORM` — the platform triple this wrapper serves (`darwin-arm64`).
|
||||
- `JAVY_VERSION` — the pinned Javy upstream version (`v8.1.1`).
|
||||
|
||||
## Usage: Basic
|
||||
|
||||
```ts
|
||||
import { getJavyBinary } from "@suaveplan/javy-cli-darwin-arm64";
|
||||
|
||||
const javy = getJavyBinary();
|
||||
// javy === "/abs/path/to/bin/javy"
|
||||
```
|
||||
|
||||
## Usage: Advanced
|
||||
|
||||
```ts
|
||||
import { getJavyBinary, JAVY_PLATFORM, JAVY_VERSION } from "@suaveplan/javy-cli-darwin-arm64";
|
||||
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. Throws `Error` when the binary is absent.
|
||||
- `JAVY_PLATFORM: "darwin-arm64"` — 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-arm-macos-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` relative to the package root. The committed sha for this wrapper is `0ae154f026371aae1e82fb39381fd58e67ca6b2a2985fbce51d305b138dad59f`. `JAVY_SKIP_DOWNLOAD=1` skips the download for offline CI sandboxes — callers MUST seed `bin/javy` themselves in that mode. The wrapper is intentionally tiny: a path string and two constants, no logic beyond fs.existsSync.
|
||||
Reference in New Issue
Block a user