no message

This commit is contained in:
A1300399510
2024-01-26 14:12:45 +08:00
parent 2ff4926405
commit 66eb0364d6
180 changed files with 2837 additions and 13232 deletions

View File

@@ -43,7 +43,7 @@ function tagToString(tag) {
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
}
function ssrRenderTags(tags, options) {
function ssrRenderTags(tags) {
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
for (const tag of tags) {
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
@@ -52,17 +52,16 @@ function ssrRenderTags(tags, options) {
}
schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
}
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
return {
headTags: schema.tags.head.join(lineBreaks),
bodyTags: schema.tags.bodyClose.join(lineBreaks),
bodyTagsOpen: schema.tags.bodyOpen.join(lineBreaks),
headTags: schema.tags.head.join("\n"),
bodyTags: schema.tags.bodyClose.join("\n"),
bodyTagsOpen: schema.tags.bodyOpen.join("\n"),
htmlAttrs: propsToString(schema.htmlAttrs),
bodyAttrs: propsToString(schema.bodyAttrs)
};
}
async function renderSSRHead(head, options) {
async function renderSSRHead(head) {
const beforeRenderCtx = { shouldRender: true };
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
if (!beforeRenderCtx.shouldRender) {
@@ -76,7 +75,7 @@ async function renderSSRHead(head, options) {
}
const ctx = { tags: await head.resolveTags() };
await head.hooks.callHook("ssr:render", ctx);
const html = ssrRenderTags(ctx.tags, options);
const html = ssrRenderTags(ctx.tags);
const renderCtx = { tags: ctx.tags, html };
await head.hooks.callHook("ssr:rendered", renderCtx);
return renderCtx.html;