@unhead/ssr 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -40,8 +40,8 @@ function ssrRenderTags(tags) {
40
40
  }
41
41
 
42
42
  async function renderSSRHead(head) {
43
- const tags = await head.resolveTags();
44
- const beforeRenderCtx = { shouldRender: true, tags };
43
+ const beforeRenderCtx = { shouldRender: true };
44
+ await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
45
45
  if (!beforeRenderCtx.shouldRender) {
46
46
  return {
47
47
  headTags: "",
@@ -51,10 +51,11 @@ async function renderSSRHead(head) {
51
51
  bodyAttrs: ""
52
52
  };
53
53
  }
54
- await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
55
- const html = ssrRenderTags(beforeRenderCtx.tags);
56
- const renderCtx = { tags, html };
57
- await head.hooks.callHook("ssr:render", renderCtx);
54
+ const ctx = { tags: await head.resolveTags() };
55
+ await head.hooks.callHook("ssr:render", ctx);
56
+ const html = ssrRenderTags(ctx.tags);
57
+ const renderCtx = { tags: ctx.tags, html };
58
+ await head.hooks.callHook("ssr:rendered", renderCtx);
58
59
  return renderCtx.html;
59
60
  }
60
61
 
package/dist/index.mjs CHANGED
@@ -38,8 +38,8 @@ function ssrRenderTags(tags) {
38
38
  }
39
39
 
40
40
  async function renderSSRHead(head) {
41
- const tags = await head.resolveTags();
42
- const beforeRenderCtx = { shouldRender: true, tags };
41
+ const beforeRenderCtx = { shouldRender: true };
42
+ await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
43
43
  if (!beforeRenderCtx.shouldRender) {
44
44
  return {
45
45
  headTags: "",
@@ -49,10 +49,11 @@ async function renderSSRHead(head) {
49
49
  bodyAttrs: ""
50
50
  };
51
51
  }
52
- await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
53
- const html = ssrRenderTags(beforeRenderCtx.tags);
54
- const renderCtx = { tags, html };
55
- await head.hooks.callHook("ssr:render", renderCtx);
52
+ const ctx = { tags: await head.resolveTags() };
53
+ await head.hooks.callHook("ssr:render", ctx);
54
+ const html = ssrRenderTags(ctx.tags);
55
+ const renderCtx = { tags: ctx.tags, html };
56
+ await head.hooks.callHook("ssr:rendered", renderCtx);
56
57
  return renderCtx.html;
57
58
  }
58
59
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/ssr",
3
3
  "type": "module",
4
- "version": "0.4.5",
4
+ "version": "0.4.6",
5
5
  "packageManager": "pnpm@7.14.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -30,10 +30,10 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@unhead/schema": "0.4.5"
33
+ "@unhead/schema": "0.4.6"
34
34
  },
35
35
  "devDependencies": {
36
- "zhead": "1.0.0-beta.11"
36
+ "zhead": "1.0.0-beta.12"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "unbuild .",