Initial Commit
This commit is contained in:
37
packages/devtools/tooling/javy-cli-linux-arm64/src/index.ts
Normal file
37
packages/devtools/tooling/javy-cli-linux-arm64/src/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/**
|
||||
* Absolute filesystem path to the bundled Javy binary for this
|
||||
* platform. `@suaveplan/wasm-compiler-javy` calls this to locate the
|
||||
* binary it spawns via `child_process.spawnSync` — the postinstall
|
||||
* script places the binary at this exact path after verifying its
|
||||
* SHA-256.
|
||||
*
|
||||
* Throws if the binary is missing (the postinstall step failed or was
|
||||
* skipped via `JAVY_SKIP_DOWNLOAD=1` without a follow-up seed). The
|
||||
* caller is expected to surface this as a structured error.
|
||||
*/
|
||||
export function getJavyBinary(): string {
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
// dist/index.js → ../bin/<name>
|
||||
const candidate = join(here, "..", "bin", "javy");
|
||||
if (!existsSync(candidate)) {
|
||||
// src/index.ts → ../bin/<name> (when running from src under bun)
|
||||
const fallback = join(here, "..", "bin", "javy");
|
||||
if (existsSync(fallback)) return fallback;
|
||||
throw new Error(
|
||||
"@suaveplan/javy-cli-linux-arm64: binary not found at " +
|
||||
candidate +
|
||||
" — did postinstall run? (set JAVY_SKIP_DOWNLOAD=1 only with a manual seed)"
|
||||
);
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
|
||||
/** Platform triple this wrapper serves. */
|
||||
export const JAVY_PLATFORM = "linux-arm64" as const;
|
||||
|
||||
/** Pinned Javy upstream version this wrapper installs. */
|
||||
export const JAVY_VERSION = "v8.1.1" as const;
|
||||
Reference in New Issue
Block a user