import type { BuildSettings } from "./build-settings.ts";
import type { PortMapping } from "./types.ts";
import { type BuildCommandIo } from "./workspace.ts";
/**
 * The result of executing a build strategy.
 */
export interface BuildArtifact {
    /** Absolute path to the directory containing the built files. */
    directory: string;
    /** Entrypoint file path, relative to `directory`, using posix separators. */
    entrypoint: string;
    /**
     * Default port mapping for the application. Used as the port mapping
     * when deploying to a newly created service and the user did not provide
     * an explicit --http-port.
     */
    defaultPortMapping?: PortMapping;
    /**
     * Optional cleanup callback. Called by the core after the archive has been
     * created and the artifact directory is no longer needed. Strategies that
     * create temporary output directories (e.g., BunBuild) use this to clean up.
     */
    cleanup?(): Promise<void>;
}
/**
 * A build strategy produces a deployable artifact.
 */
export interface BuildStrategy {
    canBuild(signal?: AbortSignal): Promise<boolean>;
    execute(signal?: AbortSignal): Promise<BuildArtifact>;
}
/**
 * Reads directly from a pre-built application directory without copying.
 * Validates the entrypoint exists.
 */
export declare class PreBuilt implements BuildStrategy {
    #private;
    constructor(options: {
        appPath: string;
        entrypoint: string;
    });
    canBuild(_signal?: AbortSignal): Promise<boolean>;
    execute(signal?: AbortSignal): Promise<BuildArtifact>;
}
/**
 * True if any of `filenames` exists at the root of `appPath`. Swallows
 * readdir errors (missing/unreadable dir) and returns false.
 */
export declare function hasRootFile(appPath: string, filenames: readonly string[], signal?: AbortSignal): Promise<boolean>;
/**
 * True if any of `packageNames` is listed in `package.json`'s `dependencies`
 * or `devDependencies`. Swallows missing-file / invalid-JSON errors and
 * returns false.
 */
export declare function hasPackageDependency(appPath: string, packageNames: readonly string[], signal?: AbortSignal): Promise<boolean>;
/**
 * Run a package's CLI inside `appPath`. Tries the project-local bin first,
 * then `npx <cliName>`, then `bunx <cliName>`. Each candidate that fails
 * with ENOENT is skipped; other failures (e.g., build errors) re-throw
 * with stderr surfaced.
 *
 * Throws with `missingMessage` if none of the launchers is available.
 */
export declare function runPackageCli(opts: {
    appPath: string;
    /** Executable name, e.g. "astro", "next", "nuxt", "vite". */
    cliName: string;
    /** Args passed to the CLI, e.g. ["build"]. */
    args: string[];
    /** Prefix used when surfacing a build failure, e.g. "Astro". */
    failurePrefix: string;
    /** Thrown when no launcher is available. */
    missingMessage: string;
    /** Extra environment merged over `process.env` for the build child. */
    env?: NodeJS.ProcessEnv;
    /** Per-line tap for build output (stdout/stderr). */
    onOutput?: (line: string, source: "stdout" | "stderr") => void;
    signal?: AbortSignal;
}): Promise<void>;
/**
 * Runs the command described by build settings. A configured shell command runs
 * as-is; a framework default can use the launcher ladder so local binaries,
 * npx, and bunx all work consistently. `null` means "skip build".
 */
export declare function runBuildSettingsCommand(options: {
    appPath: string;
    settings: Pick<BuildSettings, "buildCommand" | "buildCommandSource">;
    failurePrefix: string;
    defaultCli?: {
        source: string;
        cliName: string;
        args: string[];
        missingMessage: string;
    };
    io?: BuildCommandIo;
    signal?: AbortSignal;
}): Promise<void>;
//# sourceMappingURL=build-strategy.d.ts.map