unhead 1.4.0 → 1.5.0

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
@@ -196,7 +196,7 @@ const TemplateParamsPlugin = shared.defineHeadPlugin({
196
196
  tag.props.content = shared.processTemplateParams(tag.props.content, params, sep);
197
197
  else if (tag.tag === "link" && typeof tag.props.href === "string")
198
198
  tag.props.href = shared.processTemplateParams(tag.props.href, params, sep);
199
- else if (tag.tag === "script" && ["application/json", "application/ld+json"].includes(tag.props.type) && tag.innerHTML)
199
+ else if (tag.tag === "script" && ["application/json", "application/ld+json"].includes(tag.props.type) && tag.innerHTML && tag.props.id !== "unhead:payload")
200
200
  tag.innerHTML = shared.processTemplateParams(tag.innerHTML, params, sep);
201
201
  }
202
202
  ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
@@ -281,6 +281,7 @@ function createHeadCore(options = {}) {
281
281
  filterMode(plugin.mode, ssr) && hooks.addHooks(plugin.hooks || {});
282
282
  },
283
283
  push(input, entryOptions) {
284
+ delete entryOptions?.head;
284
285
  const entry = {
285
286
  _i: entryCount++,
286
287
  input,
@@ -419,7 +420,8 @@ function getActiveHead() {
419
420
  }
420
421
 
421
422
  function useHead(input, options = {}) {
422
- return getActiveHead()?.push(input, options);
423
+ const head = options.head || getActiveHead();
424
+ return head?.push(input, options);
423
425
  }
424
426
 
425
427
  function useHeadSafe(input, options = {}) {
package/dist/index.mjs CHANGED
@@ -195,7 +195,7 @@ const TemplateParamsPlugin = defineHeadPlugin({
195
195
  tag.props.content = processTemplateParams(tag.props.content, params, sep);
196
196
  else if (tag.tag === "link" && typeof tag.props.href === "string")
197
197
  tag.props.href = processTemplateParams(tag.props.href, params, sep);
198
- else if (tag.tag === "script" && ["application/json", "application/ld+json"].includes(tag.props.type) && tag.innerHTML)
198
+ else if (tag.tag === "script" && ["application/json", "application/ld+json"].includes(tag.props.type) && tag.innerHTML && tag.props.id !== "unhead:payload")
199
199
  tag.innerHTML = processTemplateParams(tag.innerHTML, params, sep);
200
200
  }
201
201
  ctx.tags = tags.filter((tag) => tag.tag !== "templateParams");
@@ -280,6 +280,7 @@ function createHeadCore(options = {}) {
280
280
  filterMode(plugin.mode, ssr) && hooks.addHooks(plugin.hooks || {});
281
281
  },
282
282
  push(input, entryOptions) {
283
+ delete entryOptions?.head;
283
284
  const entry = {
284
285
  _i: entryCount++,
285
286
  input,
@@ -418,7 +419,8 @@ function getActiveHead() {
418
419
  }
419
420
 
420
421
  function useHead(input, options = {}) {
421
- return getActiveHead()?.push(input, options);
422
+ const head = options.head || getActiveHead();
423
+ return head?.push(input, options);
422
424
  }
423
425
 
424
426
  function useHeadSafe(input, options = {}) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.5.0",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -30,9 +30,9 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "hookable": "^5.5.3",
33
- "@unhead/dom": "1.4.0",
34
- "@unhead/schema": "1.4.0",
35
- "@unhead/shared": "1.4.0"
33
+ "@unhead/dom": "1.5.0",
34
+ "@unhead/schema": "1.5.0",
35
+ "@unhead/shared": "1.5.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "unbuild .",