astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
31 lines (30 loc) • 1.11 kB
JavaScript
import { getOutDirWithinCwd } from "../core/build/common.js";
export function getPrerenderDefault(config) {
return config.output !== "server";
}
/**
* Returns the correct output directory of the SSR build based on the configuration
*/
export function getServerOutputDirectory(settings) {
const preserveStructure = settings.adapter?.adapterFeatures?.preserveBuildServerDir;
if (settings.buildOutput === "server" || preserveStructure) {
return settings.config.build.server;
}
return getOutDirWithinCwd(settings.config.outDir);
}
/**
* Returns the output directory used by the prerender environment.
*/
export function getPrerenderOutputDirectory(settings) {
return new URL("./.prerender/", getServerOutputDirectory(settings));
}
/**
* Returns the correct output directory of the client build based on the configuration
*/
export function getClientOutputDirectory(settings) {
const preserveStructure = settings.adapter?.adapterFeatures?.preserveBuildClientDir;
if (settings.buildOutput === "server" || preserveStructure) {
return settings.config.build.client;
}
return settings.config.outDir;
}