import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
  readBuildMetadata
} from "./chunk-BYP4JZFS.js";
import {
  pathExists
} from "./chunk-AYCGCYN3.js";
import {
  CliError,
  CliErrorCode
} from "./chunk-WGV2XQSB.js";
import {
  init_esm_shims
} from "./chunk-EXLZF52D.js";

// ../cli-astro-commands/src/files/assert-build-output-exists.ts
init_esm_shims();
async function assertBuildOutputExists(projectFolder) {
  const buildMetadata = await readBuildMetadata(projectFolder);
  const targets = [
    buildMetadata.appManifestPath,
    buildMetadata.outDir,
    buildMetadata.clientDir,
    ...buildMetadata.serverDir ? [buildMetadata.serverDir] : []
  ];
  for (const target of targets) {
    if (!await pathExists(target)) {
      throw new CliError({
        code: CliErrorCode.BuildOutputMissing({
          reason: `"${target}" build output file is missing.`
        }),
        cause: null
      });
    }
  }
}

export {
  assertBuildOutputExists
};
//# sourceMappingURL=chunk-VS2OAVVQ.js.map