/**
 * Build output packaging.
 *
 * After a framework adapter builds the project, the packager:
 * 1. Generates launch metadata (how to start the app)
 * 2. Writes launch.json
 *
 * The output is a self-contained directory ready for deployment
 * as a buildpack image layer or traditional zip upload.
 */
import { generateLaunchMetadata, readUserLaunchOverride, writeLaunchMetadata, } from "./launch.js";
/**
 * Package a build result into a deployment-ready directory.
 *
 * If `projectDir` is supplied and contains a user-authored `launch.json`,
 * its fields override the generated launch metadata. See
 * `readUserLaunchOverride` for the merge semantics.
 */
export function packageBuildOutput(framework, buildResult, outputDir, projectDir, monorepo) {
    const override = projectDir ? readUserLaunchOverride(projectDir) : null;
    // Generate launch metadata (with optional user override applied).
    // In monorepo mode, every process inherits the subpackage as its
    // `workingDirectory` so pilot launches inside the right subdir.
    const launch = generateLaunchMetadata(framework, buildResult, override, monorepo);
    // Write launch metadata to the output directory
    writeLaunchMetadata(outputDir, launch);
    return {
        outputDir,
        launch,
        hasStaticAssets: !!buildResult.staticDir,
        staticDir: buildResult.staticDir,
    };
}
//# sourceMappingURL=index.js.map