/** * Workspace-aware build primitives shared by the framework strategies. These * are location-agnostic: they take an explicit app directory and walk up to * the source root (the repository or workspace boundary), so a build invoked * from inside a monorepo package resolves the same package manager and * binaries it would at the workspace root. Nothing here reads `process.cwd()` * or prompts. */ export type PackageManager = "bun" | "pnpm" | "yarn" | "npm"; /** * Build-environment hooks a consumer threads into a strategy: extra `env` for * the build child and a per-line output tap. Both are optional, so the CLI * keeps today's behavior while a headless consumer (the build-runner) injects * deploy vars and streams a live build log. */ export interface BuildCommandIo { env?: NodeJS.ProcessEnv; onOutput?: (line: string, source: "stdout" | "stderr") => void; } /** * Detects the package manager governing `appPath` by walking from the app up * to the source root: the nearest `packageManager` field wins, then the * nearest lockfile. Workspace repos keep both at the root, so a package * deep in a monorepo still resolves correctly. Returns undefined when no * signal is found. */ export declare function resolvePackageManager(appPath: string, signal?: AbortSignal): Promise; /** * Build environment for `appPath`: every `node_modules/.bin` between the app * and its source root, prepended to PATH. Workspace repos hoist binaries like * `next` to the workspace root, so a build run from a package directory still * finds them. The returned object is suitable as the `env` for a child build * process. */ export declare function buildCommandEnv(appPath: string, baseEnv: NodeJS.ProcessEnv, signal?: AbortSignal): Promise; /** * Runs a build command string inside `appPath`, with every ancestor * `node_modules/.bin` on PATH so workspace-hoisted binaries resolve. Rejects * with the framework prefix and captured output on a non-zero exit. */ export declare function runBuildCommand(options: { appPath: string; command: string; failurePrefix: string; /** * Extra environment merged over `process.env` for the build child (after * the ancestor-bin PATH). A headless consumer (e.g. the build-runner) uses * this to inject per-branch deploy vars and build flags; the CLI passes none. */ env?: NodeJS.ProcessEnv; /** * Per-line tap for build output, called as each line arrives on stdout or * stderr. Lets a consumer stream a live build log instead of waiting for the * process to exit; the CLI passes none. */ onOutput?: (line: string, source: "stdout" | "stderr") => void; signal?: AbortSignal; }): Promise; /** * Spawns a child build process, streaming each output line to `onOutput` and * keeping a bounded tail for the failure message instead of buffering the whole * build. Resolves on a zero exit; rejects on a non-zero exit (with the prefix, * exit code, and tail) or a spawn error (whose `code`, e.g. ENOENT, is * preserved on the rejection so a launcher ladder can branch on it). * * Shared by `runBuildCommand` (a shell command string) and `runPackageCli` * (an explicit binary + args). */ export declare function runChildProcess(options: { command: string; args: readonly string[]; cwd: string; env: NodeJS.ProcessEnv; shell?: boolean; failurePrefix: string; onOutput?: (line: string, source: "stdout" | "stderr") => void; signal?: AbortSignal; }): Promise; /** A `package.json`'s build-relevant fields. */ export interface PackageManifest { packageManager?: unknown; scripts?: Record; main?: unknown; module?: unknown; } /** Reads and parses `appPath/package.json`, returning null on any failure. */ export declare function readPackageManifest(appPath: string, signal?: AbortSignal): Promise; /** The trimmed `scripts.build` string, or null when absent or empty. */ export declare function readBuildScript(manifest: PackageManifest | null): string | null; //# sourceMappingURL=workspace.d.ts.map