IOweb/node_modules/astro/dist/core/output-filename.js
2026-07-03 15:07:38 -05:00

20 lines
694 B
JavaScript

import { removeTrailingForwardSlash } from "./path.js";
const STATUS_CODE_PAGES = /* @__PURE__ */ new Set(["/404", "/500"]);
function getOutputFilename(buildFormat, name, routeData) {
if (routeData.type === "endpoint") {
return name;
}
if (name === "/" || name === "") {
return name === "" ? "index.html" : "/index.html";
}
if (buildFormat === "file" || STATUS_CODE_PAGES.has(name)) {
return `${removeTrailingForwardSlash(name || "index")}.html`;
}
if (buildFormat === "preserve" && !routeData.isIndex) {
return `${removeTrailingForwardSlash(name || "index")}.html`;
}
return `${removeTrailingForwardSlash(name)}/index.html`;
}
export {
getOutputFilename
};