no message
This commit is contained in:
13
.output/server/node_modules/@unhead/ssr/dist/index.mjs
generated
vendored
13
.output/server/node_modules/@unhead/ssr/dist/index.mjs
generated
vendored
@@ -43,7 +43,7 @@ function tagToString(tag) {
|
||||
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
|
||||
}
|
||||
|
||||
function ssrRenderTags(tags) {
|
||||
function ssrRenderTags(tags, options) {
|
||||
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
|
||||
for (const tag of tags) {
|
||||
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
|
||||
@@ -52,16 +52,17 @@ function ssrRenderTags(tags) {
|
||||
}
|
||||
schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
|
||||
}
|
||||
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
|
||||
return {
|
||||
headTags: schema.tags.head.join("\n"),
|
||||
bodyTags: schema.tags.bodyClose.join("\n"),
|
||||
bodyTagsOpen: schema.tags.bodyOpen.join("\n"),
|
||||
headTags: schema.tags.head.join(lineBreaks),
|
||||
bodyTags: schema.tags.bodyClose.join(lineBreaks),
|
||||
bodyTagsOpen: schema.tags.bodyOpen.join(lineBreaks),
|
||||
htmlAttrs: propsToString(schema.htmlAttrs),
|
||||
bodyAttrs: propsToString(schema.bodyAttrs)
|
||||
};
|
||||
}
|
||||
|
||||
async function renderSSRHead(head) {
|
||||
async function renderSSRHead(head, options) {
|
||||
const beforeRenderCtx = { shouldRender: true };
|
||||
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
|
||||
if (!beforeRenderCtx.shouldRender) {
|
||||
@@ -75,7 +76,7 @@ async function renderSSRHead(head) {
|
||||
}
|
||||
const ctx = { tags: await head.resolveTags() };
|
||||
await head.hooks.callHook("ssr:render", ctx);
|
||||
const html = ssrRenderTags(ctx.tags);
|
||||
const html = ssrRenderTags(ctx.tags, options);
|
||||
const renderCtx = { tags: ctx.tags, html };
|
||||
await head.hooks.callHook("ssr:rendered", renderCtx);
|
||||
return renderCtx.html;
|
||||
|
||||
Reference in New Issue
Block a user