unhead 1.0.6 → 1.0.8

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
@@ -27,6 +27,8 @@ async function normaliseTag(tagName, input) {
27
27
  ["children", "innerHtml", "innerHTML"].forEach((key) => {
28
28
  if (typeof tag.props[key] !== "undefined") {
29
29
  tag.children = tag.props[key];
30
+ if (typeof tag.children === "object")
31
+ tag.children = JSON.stringify(tag.children);
30
32
  delete tag.props[key];
31
33
  }
32
34
  });
@@ -610,6 +612,10 @@ function createHeadCore(options = {}) {
610
612
  get hooks() {
611
613
  return hooks;
612
614
  },
615
+ use(plugin) {
616
+ if (plugin.hooks)
617
+ hooks.addHooks(plugin.hooks);
618
+ },
613
619
  push(input, options2) {
614
620
  const activeEntry = {
615
621
  _i: _eid++,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _unhead_schema from '@unhead/schema';
2
- import { Head, HeadEntryOptions, ActiveHeadEntry, Title, Base, Meta, MetaFlatInput, Link, Script, Style, Noscript, HtmlAttributes, BodyAttributes, TitleTemplate, Unhead, CreateHeadOptions, HeadPlugin, HeadEntry, HeadTag } from '@unhead/schema';
2
+ import { Head, HeadEntryOptions, ActiveHeadEntry, Title, Base, Meta, MetaFlatInput, Link, Script, Style, Noscript, HtmlAttributes, BodyAttributes, TitleTemplate, Unhead, HeadPlugin, CreateHeadOptions, HeadEntry, HeadTag } from '@unhead/schema';
3
3
  import { RenderDomHeadOptions } from '@unhead/dom';
4
4
 
5
5
  interface DedupesTagsPluginOptions {
@@ -62,8 +62,8 @@ declare let activeHead: Unhead<any> | undefined;
62
62
  declare const setActiveHead: (head: Unhead<any> | undefined) => Unhead<any> | undefined;
63
63
  declare const getActiveHead: () => Unhead<any> | undefined;
64
64
 
65
- declare const CorePlugins: () => _unhead_schema.HeadPlugin[];
66
- declare const DOMPlugins: (options?: CreateHeadOptions) => _unhead_schema.HeadPlugin[];
65
+ declare const CorePlugins: () => HeadPlugin[];
66
+ declare const DOMPlugins: (options?: CreateHeadOptions) => HeadPlugin[];
67
67
  declare function createHead<T extends {} = Head>(options?: CreateHeadOptions): Unhead<T>;
68
68
  /**
69
69
  * Creates a core instance of unhead. Does not provide a global ctx for composables to work
package/dist/index.mjs CHANGED
@@ -25,6 +25,8 @@ async function normaliseTag(tagName, input) {
25
25
  ["children", "innerHtml", "innerHTML"].forEach((key) => {
26
26
  if (typeof tag.props[key] !== "undefined") {
27
27
  tag.children = tag.props[key];
28
+ if (typeof tag.children === "object")
29
+ tag.children = JSON.stringify(tag.children);
28
30
  delete tag.props[key];
29
31
  }
30
32
  });
@@ -608,6 +610,10 @@ function createHeadCore(options = {}) {
608
610
  get hooks() {
609
611
  return hooks;
610
612
  },
613
+ use(plugin) {
614
+ if (plugin.hooks)
615
+ hooks.addHooks(plugin.hooks);
616
+ },
611
617
  push(input, options2) {
612
618
  const activeEntry = {
613
619
  _i: _eid++,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "1.0.6",
5
- "packageManager": "pnpm@7.17.1",
4
+ "version": "1.0.8",
5
+ "packageManager": "pnpm@7.18.1",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -31,11 +31,11 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "hookable": "^5.4.2",
34
- "@unhead/dom": "1.0.6",
35
- "@unhead/schema": "1.0.6"
34
+ "@unhead/dom": "1.0.8",
35
+ "@unhead/schema": "1.0.8"
36
36
  },
37
37
  "devDependencies": {
38
- "zhead": "^1.0.4"
38
+ "zhead": "^1.0.7"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "unbuild .",