import { type FoundNode } from './runtime.ts'; /** Where nodejs.org keeps its releases: `BUNDLE_NODE_MIRROR` points it elsewhere. */ export declare function nodeMirror(env?: NodeJS.ProcessEnv): string; /** * Where bundle keeps the nodes it downloads, one directory per version: * `BUNDLE_NODE_DIR`, else `bundle/node` in the data directory. The launcher * looks here too, by the same rule, so a node put here runs every bundle. */ export declare function nodesDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string; /** Where, inside a version's directory, its node is. */ export declare function nodeIn(dir: string, platform?: NodeJS.Platform): string; /** One release, as nodejs.org's `index.json` lists it. */ export interface Release { version: string; lts: string | false; files: string[]; } /** What to fetch of a release for one platform: its name in `files`, the archive, and the binary's member in it. */ export interface Build { key: string; archive: string; member: string; } /** The build of `version` for this platform and CPU, or undefined where nodejs.org has none. */ export declare function buildFor(version: string, platform?: NodeJS.Platform, arch?: string): Build | undefined; /** * The release to install: the newest LTS at or above `minimum` that has a * build for this platform, else the newest release that does. Undefined when * none is new enough. */ export declare function chooseRelease(index: Release[], minimum?: string, platform?: NodeJS.Platform, arch?: string): Release | undefined; /** A version run to say its version, or undefined when it does not. */ export type VersionOf = (node: string) => string | undefined; /** * Every place the launcher looks for a node on macOS and Linux, after PATH: * each manager's directory of versions, and where in a version's directory * its node is. Kept in the launcher's order, and checked against it by the * tests, so the two cannot disagree about which node an app would run with. */ export declare function unixRoots(env?: NodeJS.ProcessEnv, home?: string): [string, string, string][]; /** * The node a bundle runs with here, at least `minimum`: on macOS and Linux * the one the launcher would pick, on Windows the one the association would * name, with the nodes bundle downloaded counted on both. Undefined when there * is none. `env`, `home`, `platform` and `run` are for tests. */ export declare function findNode({ minimum, env, home, platform, run }?: { minimum?: string | undefined; env?: NodeJS.ProcessEnv | undefined; home?: string | undefined; platform?: NodeJS.Platform | undefined; run?: VersionOf | undefined; }): FoundNode | undefined; /** A version manager that can be asked for a node without making it the default. */ export interface Manager { name: string; /** The command that installs `version` (`v27.1.0`). */ command(version: string): string[]; } /** * The version managers here that bundle would ask, in the order it would ask * them. A manager is here when its command is on PATH — or, for nvm, which is * a shell function rather than a command, when its `nvm.sh` is where NVM_DIR * says. asdf only counts with its nodejs plugin added: adding plugins is the * person's business. */ export declare function managers({ env, home, platform, has, asdfHasNode }?: { env?: NodeJS.ProcessEnv | undefined; home?: string | undefined; platform?: NodeJS.Platform | undefined; has?: ((command: string) => boolean) | undefined; asdfHasNode?: (() => boolean) | undefined; }): Manager[]; export interface EnsureOptions { /** The oldest node that will do (default: what --vfs-load needs). */ minimum?: string | undefined; /** * How to get one when there is none: `auto` (a version manager, else a * download), `download` (never a manager), or one manager by name. */ via?: string | undefined; log?: ((line: string) => void) | undefined; /** For tests: everything below. */ fetch?: typeof globalThis.fetch | undefined; env?: NodeJS.ProcessEnv | undefined; home?: string | undefined; platform?: NodeJS.Platform | undefined; arch?: string | undefined; run?: VersionOf | undefined; managers?: readonly Manager[] | undefined; spawn?: ((command: string[]) => { status: number | null; error?: Error | undefined; }) | undefined; } export interface Ensured { node: FoundNode; /** `found` (it was there), a manager's name, or `download`. */ how: string; } /** * A node at least `minimum` to run bundles with: the one that is here, else * one installed by a version manager, else one downloaded into `nodesDir()` * (see the top of this file). Throws when none of that gets one. */ export declare function ensureNode(options?: EnsureOptions): Promise; /** The release `ensureNode()` would install, from the mirror's `index.json`. */ export declare function latestRelease(minimum?: string, options?: Pick): Promise; /** * Download `release`'s official build, check it against the release's * SHASUMS256.txt, and keep only its node binary, in `nodesDir()/`. * It is assembled beside where it goes and renamed into place, so a version's * directory is either complete or absent; and the node it holds has to say it * is that version before it counts. */ export declare function downloadNode(release: Release, options?: EnsureOptions): Promise; /** The sha256 SHASUMS256.txt gives `file`, or undefined when it gives none. */ export declare function checksumOf(sums: string, file: string): string | undefined; /** The nodes bundle has downloaded, newest first. */ export declare function ownNodes(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): { version: string; path: string; }[]; //# sourceMappingURL=nodes.d.ts.map