import type { HtmlShellOptions } from "./html.shared"; export type { HtmlShellOptions }; import { cspMeta } from "./security"; export function htmlShell(opts: HtmlShellOptions): string { const { title, description, body, favicon, css, js, nonce, csp, extraScripts, themeCss, depth = 0, headExtra, bodyExtra, absoluteAssets = false, } = opts; const nonceAttr = nonce ? ` nonce="${Bun.escapeHTML(nonce)}"` : ""; const themeStyle = themeCss ? `\n ` : ""; const headInjection = headExtra?.length ? `\n ${headExtra.join("\n ")}` : ""; const bodyInjection = bodyExtra?.length ? `\n ${bodyExtra.join("\n ")}` : ""; const depthPrefix = depth === 0 ? "" : "../".repeat(depth); const assetPrefix = absoluteAssets ? "/assets/" : depthPrefix + "assets/"; const clientScript = js ? `\n \n ` : ""; const resolvePath = (path: string) => absoluteAssets ? path : path.startsWith("/") ? depthPrefix + path.slice(1) : path; // Build SEO meta tags (OG, Twitter, canonical) let seoTags = ""; if (opts.seo) { const s = opts.seo; const e = Bun.escapeHTML; seoTags = `\n \n \n \n \n \n \n `; if (s.image) { seoTags += `\n `; } } return `
${msg}${st ? `\n\n${st}` : ""}
`;
}
export function hmrScript(nonce: string): string {
return ``;
}