/** * @file `jreFromDownload()` — fetches Adoptium JRE and returns a `ResolvedJre` * pointing at the extracted java binary. Wraps the generic * `downloadAndExtractTool` with JRE-specific knowledge: * * - URL construction via `getAdoptiumDownloadUrl` * - default cache layout: `/jre///` * - locating `bin/java(.exe)` within the extracted tree Returns `undefined` * when: * - Adoptium has no build for the target `platformArch` * - The extracted tree doesn't contain a recognizable JRE layout Idempotent — * re-running with the same `{version, platformArch}` after a successful * first run is a quick cache check, no network. Trust-on-first-use: pass * `integrity` from `external-tools.json` when available. Omit it on first * install; the helper logs the computed SRI through `result.integrity` * (currently surfaced only as a side effect of the underlying call; future * revision may surface it via an out-param so consumers can record the * pin). */ import type { BinaryDownloader } from '../from-download.js'; import type { HashInput } from '../../crypto/integrity.js'; import type { ResolvedJre } from './types.js'; export interface JreFromDownloadOptions { /** * Java feature version — the major version number, e.g. `21`. */ version: number; /** * Socket platform-arch token, e.g. `'darwin-arm64'`. */ platformArch: string; /** * Optional pinned integrity from `external-tools.json`. When set, the * download is verified against this hash; verification failure throws (from * the dlx layer). */ integrity?: HashInput | undefined; /** * Override the cache directory. By default the JRE extracts into * `/jre///`. */ cacheDir?: string | undefined; /** * Inject a custom downloader. Forwarded to the underlying * `downloadAndExtractTool`. Defaults to dlx. */ downloader?: BinaryDownloader | undefined; } /** * Resolve a JRE by downloading it from Adoptium. Returns the standard * `ResolvedJre` shape with `source: 'download'`. * * @example * ;```typescript * const jre = await jreFromDownload({ * version: 21, * platformArch: 'darwin-arm64', * }) * // → { javaPath: '/.../bin/java', javaHome: '/...', source: 'download' } * ``` */ export declare function jreFromDownload(options: JreFromDownloadOptions): Promise;