unhead 2.0.0-alpha.22 → 2.0.0-alpha.24

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/client.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { am as Head, n as CreateClientHeadOptions, p as Unhead, z as RenderDomHeadOptions } from './shared/unhead.B4pP8_2D.mjs';
1
+ import { am as ResolvableHead, n as CreateClientHeadOptions, p as Unhead, z as RenderDomHeadOptions } from './shared/unhead.H9K4hNc3.mjs';
2
2
  import 'hookable';
3
3
 
4
- declare function createHead<T = Head>(options?: CreateClientHeadOptions): Unhead<T>;
4
+ declare function createHead<T = ResolvableHead>(options?: CreateClientHeadOptions): Unhead<T>;
5
5
 
6
6
  /**
7
7
  * Render the head tags to the DOM.
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { am as Head, n as CreateClientHeadOptions, p as Unhead, z as RenderDomHeadOptions } from './shared/unhead.B4pP8_2D.js';
1
+ import { am as ResolvableHead, n as CreateClientHeadOptions, p as Unhead, z as RenderDomHeadOptions } from './shared/unhead.H9K4hNc3.js';
2
2
  import 'hookable';
3
3
 
4
- declare function createHead<T = Head>(options?: CreateClientHeadOptions): Unhead<T>;
4
+ declare function createHead<T = ResolvableHead>(options?: CreateClientHeadOptions): Unhead<T>;
5
5
 
6
6
  /**
7
7
  * Render the head tags to the DOM.
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createHeadCore } from './shared/unhead.x5NJGkxU.mjs';
1
+ import { c as createHeadCore } from './shared/unhead.kC9yNSGl.mjs';
2
2
  import { H as HasElementTags } from './shared/unhead.yem5I2v_.mjs';
3
3
  import { h as hashTag, i as isMetaArrayDupeKey, a as normalizeProps, d as dedupeKey } from './shared/unhead.xsi8MZXD.mjs';
4
4
  import 'hookable';
package/dist/index.d.mts CHANGED
@@ -1,16 +1,28 @@
1
- import { H as HeadSafe } from './shared/unhead.B7BBWq8B.mjs';
2
- import { p as Unhead, o as HeadEntryOptions, l as ActiveHeadEntry, ao as UseSeoMetaInput, am as Head, C as CreateHeadOptions } from './shared/unhead.B4pP8_2D.mjs';
3
- export { u as useScript } from './shared/unhead.DcPrZw2e.mjs';
1
+ import { H as HeadSafe } from './shared/unhead.D5hDM0h5.mjs';
2
+ import { p as Unhead, o as HeadEntryOptions, l as ActiveHeadEntry, ap as UseSeoMetaInput, am as ResolvableHead, C as CreateHeadOptions } from './shared/unhead.H9K4hNc3.mjs';
3
+ export { u as useScript } from './shared/unhead.CMEjo4Tf.mjs';
4
4
  import 'hookable';
5
5
 
6
6
  declare function useHead<T extends Unhead<any>>(unhead: T, input?: Parameters<T['push']>[0], options?: HeadEntryOptions): ReturnType<T['push']>;
7
7
  declare function useHeadSafe<T extends Unhead<any>>(unhead: T, input?: HeadSafe, options?: HeadEntryOptions): ActiveHeadEntry<HeadSafe>;
8
8
  declare function useSeoMeta<T extends Unhead<any>>(unhead: T, input?: UseSeoMetaInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSeoMetaInput>;
9
+ /**
10
+ * @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
11
+ */
12
+ declare function useServerHead<T extends Unhead<any>>(unhead: T, input?: Parameters<T['push']>[0], options?: Omit<HeadEntryOptions, 'mode'>): ReturnType<T['push']>;
13
+ /**
14
+ * @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
15
+ */
16
+ declare function useServerHeadSafe<T extends Unhead<any>>(unhead: T, input?: HeadSafe, options?: Omit<HeadEntryOptions, 'mode'>): ActiveHeadEntry<HeadSafe>;
17
+ /**
18
+ * @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
19
+ */
20
+ declare function useServerSeoMeta<T extends Unhead<any>>(unhead: T, input?: UseSeoMetaInput, options?: Omit<HeadEntryOptions, 'mode'>): ActiveHeadEntry<UseSeoMetaInput>;
9
21
 
10
22
  /**
11
23
  * Creates a core instance of unhead. Does not provide a global ctx for composables to work
12
24
  * and does not register DOM plugins.
13
25
  */
14
- declare function createHeadCore<T = Head>(resolvedOptions?: CreateHeadOptions): Unhead<T>;
26
+ declare function createHeadCore<T = ResolvableHead>(resolvedOptions?: CreateHeadOptions): Unhead<T>;
15
27
 
16
- export { createHeadCore, useHead, useHeadSafe, useSeoMeta };
28
+ export { createHeadCore, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,28 @@
1
- import { H as HeadSafe } from './shared/unhead.D_YYNboR.js';
2
- import { p as Unhead, o as HeadEntryOptions, l as ActiveHeadEntry, ao as UseSeoMetaInput, am as Head, C as CreateHeadOptions } from './shared/unhead.B4pP8_2D.js';
3
- export { u as useScript } from './shared/unhead.CES0yIUs.js';
1
+ import { H as HeadSafe } from './shared/unhead.CYOiVxYm.js';
2
+ import { p as Unhead, o as HeadEntryOptions, l as ActiveHeadEntry, ap as UseSeoMetaInput, am as ResolvableHead, C as CreateHeadOptions } from './shared/unhead.H9K4hNc3.js';
3
+ export { u as useScript } from './shared/unhead.f-vxWgdH.js';
4
4
  import 'hookable';
5
5
 
6
6
  declare function useHead<T extends Unhead<any>>(unhead: T, input?: Parameters<T['push']>[0], options?: HeadEntryOptions): ReturnType<T['push']>;
7
7
  declare function useHeadSafe<T extends Unhead<any>>(unhead: T, input?: HeadSafe, options?: HeadEntryOptions): ActiveHeadEntry<HeadSafe>;
8
8
  declare function useSeoMeta<T extends Unhead<any>>(unhead: T, input?: UseSeoMetaInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSeoMetaInput>;
9
+ /**
10
+ * @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
11
+ */
12
+ declare function useServerHead<T extends Unhead<any>>(unhead: T, input?: Parameters<T['push']>[0], options?: Omit<HeadEntryOptions, 'mode'>): ReturnType<T['push']>;
13
+ /**
14
+ * @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
15
+ */
16
+ declare function useServerHeadSafe<T extends Unhead<any>>(unhead: T, input?: HeadSafe, options?: Omit<HeadEntryOptions, 'mode'>): ActiveHeadEntry<HeadSafe>;
17
+ /**
18
+ * @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
19
+ */
20
+ declare function useServerSeoMeta<T extends Unhead<any>>(unhead: T, input?: UseSeoMetaInput, options?: Omit<HeadEntryOptions, 'mode'>): ActiveHeadEntry<UseSeoMetaInput>;
9
21
 
10
22
  /**
11
23
  * Creates a core instance of unhead. Does not provide a global ctx for composables to work
12
24
  * and does not register DOM plugins.
13
25
  */
14
- declare function createHeadCore<T = Head>(resolvedOptions?: CreateHeadOptions): Unhead<T>;
26
+ declare function createHeadCore<T = ResolvableHead>(resolvedOptions?: CreateHeadOptions): Unhead<T>;
15
27
 
16
- export { createHeadCore, useHead, useHeadSafe, useSeoMeta };
28
+ export { createHeadCore, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { u as useHead, a as useHeadSafe, b as useSeoMeta } from './shared/unhead.C2emW6l4.mjs';
2
- export { c as createHeadCore } from './shared/unhead.x5NJGkxU.mjs';
1
+ export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.PEkM8z0l.mjs';
2
+ export { c as createHeadCore } from './shared/unhead.kC9yNSGl.mjs';
3
3
  export { u as useScript } from './shared/unhead.CG0hxuzW.mjs';
4
4
  import './shared/unhead.z5bPaiJg.mjs';
5
5
  import './shared/unhead.DFwCX-QT.mjs';
package/dist/legacy.d.mts CHANGED
@@ -1,14 +1,14 @@
1
- export { createHeadCore, useHead, useHeadSafe, useSeoMeta } from './index.mjs';
2
- import { p as Unhead, am as Head, C as CreateHeadOptions } from './shared/unhead.B4pP8_2D.mjs';
3
- export { u as useScript } from './shared/unhead.DcPrZw2e.mjs';
4
- import './shared/unhead.B7BBWq8B.mjs';
1
+ export { createHeadCore, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta } from './index.mjs';
2
+ import { p as Unhead, am as ResolvableHead, C as CreateHeadOptions } from './shared/unhead.H9K4hNc3.mjs';
3
+ export { u as useScript } from './shared/unhead.CMEjo4Tf.mjs';
4
+ import './shared/unhead.D5hDM0h5.mjs';
5
5
  import 'hookable';
6
6
 
7
7
  declare const activeHead: {
8
8
  value: Unhead<any> | null;
9
9
  };
10
10
  declare function getActiveHead(): Unhead<any> | null;
11
- declare function createServerHead<T extends Record<string, any> = Head>(options?: CreateHeadOptions): Unhead<T>;
12
- declare function createHead<T extends Record<string, any> = Head>(options?: CreateHeadOptions): Unhead<T>;
11
+ declare function createServerHead<T extends Record<string, any> = ResolvableHead>(options?: CreateHeadOptions): Unhead<T>;
12
+ declare function createHead<T extends Record<string, any> = ResolvableHead>(options?: CreateHeadOptions): Unhead<T>;
13
13
 
14
14
  export { activeHead, createHead, createServerHead, getActiveHead };
package/dist/legacy.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export { createHeadCore, useHead, useHeadSafe, useSeoMeta } from './index.js';
2
- import { p as Unhead, am as Head, C as CreateHeadOptions } from './shared/unhead.B4pP8_2D.js';
3
- export { u as useScript } from './shared/unhead.CES0yIUs.js';
4
- import './shared/unhead.D_YYNboR.js';
1
+ export { createHeadCore, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta } from './index.js';
2
+ import { p as Unhead, am as ResolvableHead, C as CreateHeadOptions } from './shared/unhead.H9K4hNc3.js';
3
+ export { u as useScript } from './shared/unhead.f-vxWgdH.js';
4
+ import './shared/unhead.CYOiVxYm.js';
5
5
  import 'hookable';
6
6
 
7
7
  declare const activeHead: {
8
8
  value: Unhead<any> | null;
9
9
  };
10
10
  declare function getActiveHead(): Unhead<any> | null;
11
- declare function createServerHead<T extends Record<string, any> = Head>(options?: CreateHeadOptions): Unhead<T>;
12
- declare function createHead<T extends Record<string, any> = Head>(options?: CreateHeadOptions): Unhead<T>;
11
+ declare function createServerHead<T extends Record<string, any> = ResolvableHead>(options?: CreateHeadOptions): Unhead<T>;
12
+ declare function createHead<T extends Record<string, any> = ResolvableHead>(options?: CreateHeadOptions): Unhead<T>;
13
13
 
14
14
  export { activeHead, createHead, createServerHead, getActiveHead };
package/dist/legacy.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { c as createHeadCore } from './shared/unhead.x5NJGkxU.mjs';
2
- import { D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin } from './shared/unhead.9Qw6eOEM.mjs';
3
- export { u as useHead, a as useHeadSafe, b as useSeoMeta } from './shared/unhead.C2emW6l4.mjs';
1
+ import { c as createHeadCore } from './shared/unhead.kC9yNSGl.mjs';
2
+ import { D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin } from './shared/unhead.Dl6vXegp.mjs';
3
+ export { u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/unhead.PEkM8z0l.mjs';
4
4
  export { u as useScript } from './shared/unhead.CG0hxuzW.mjs';
5
5
  import 'hookable';
6
6
  import './shared/unhead.xsi8MZXD.mjs';
@@ -1,4 +1,4 @@
1
- import { j as HeadPluginInput } from './shared/unhead.B4pP8_2D.mjs';
1
+ import { j as HeadPluginInput } from './shared/unhead.H9K4hNc3.mjs';
2
2
  import 'hookable';
3
3
 
4
4
  declare const AliasSortingPlugin: HeadPluginInput;
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { j as HeadPluginInput } from './shared/unhead.B4pP8_2D.js';
1
+ import { j as HeadPluginInput } from './shared/unhead.H9K4hNc3.js';
2
2
  import 'hookable';
3
3
 
4
4
  declare const AliasSortingPlugin: HeadPluginInput;
package/dist/plugins.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.9Qw6eOEM.mjs';
1
+ export { A as AliasSortingPlugin, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.Dl6vXegp.mjs';
2
2
  import { d as defineHeadPlugin } from './shared/unhead.z5bPaiJg.mjs';
3
3
  export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.z5bPaiJg.mjs';
4
4
  import './shared/unhead.DZbvapt-.mjs';
@@ -56,14 +56,14 @@ function InferSeoMetaPlugin(options = {}) {
56
56
  tagPriority: "low"
57
57
  },
58
58
  {
59
- property: "og:title",
60
- content: "%infer",
61
- tagPriority: "low"
59
+ "property": "og:title",
60
+ "tagPriority": "low",
61
+ "data-infer": ""
62
62
  },
63
63
  {
64
- property: "og:description",
65
- content: "%infer",
66
- tagPriority: "low"
64
+ "property": "og:description",
65
+ "tagPriority": "low",
66
+ "data-infer": ""
67
67
  }
68
68
  ]
69
69
  });
@@ -74,7 +74,7 @@ function InferSeoMetaPlugin(options = {}) {
74
74
  let title = head._title || "";
75
75
  const titleTemplate = head._titleTemplate;
76
76
  const ogTitle = tagMap.get("meta:og:title");
77
- if (ogTitle?.props?.content === "%infer") {
77
+ if (typeof ogTitle?.props["data-infer"] !== "undefined") {
78
78
  if (titleTemplate) {
79
79
  title = typeof titleTemplate === "function" ? titleTemplate(title) : titleTemplate.replace("%s", title);
80
80
  }
@@ -82,7 +82,7 @@ function InferSeoMetaPlugin(options = {}) {
82
82
  }
83
83
  const description = tagMap.get("meta:description")?.props?.content;
84
84
  const ogDescription = tagMap.get("meta:og:description");
85
- if (ogDescription?.props?.content === "%infer") {
85
+ if (typeof ogDescription?.props["data-infer"] !== "undefined") {
86
86
  ogDescription.props.content = options.ogDescription ? options.ogDescription(description) : description || "";
87
87
  }
88
88
  }
@@ -1,6 +1,6 @@
1
- import { R as RecordingEntry } from './shared/unhead.B4pP8_2D.mjs';
2
- export { A as AsVoidFunctions, E as EventHandlerOptions, S as ScriptInstance, d as UseFunctionType, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.B4pP8_2D.mjs';
3
- export { u as useScript } from './shared/unhead.DcPrZw2e.mjs';
1
+ import { R as RecordingEntry } from './shared/unhead.H9K4hNc3.mjs';
2
+ export { A as AsVoidFunctions, E as EventHandlerOptions, S as ScriptInstance, d as UseFunctionType, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.H9K4hNc3.mjs';
3
+ export { u as useScript } from './shared/unhead.CMEjo4Tf.mjs';
4
4
  import 'hookable';
5
5
 
6
6
  declare function createSpyProxy<T extends Record<string, any> | any[]>(target: T, onApply: (stack: RecordingEntry[][]) => void): T;
package/dist/scripts.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { R as RecordingEntry } from './shared/unhead.B4pP8_2D.js';
2
- export { A as AsVoidFunctions, E as EventHandlerOptions, S as ScriptInstance, d as UseFunctionType, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.B4pP8_2D.js';
3
- export { u as useScript } from './shared/unhead.CES0yIUs.js';
1
+ import { R as RecordingEntry } from './shared/unhead.H9K4hNc3.js';
2
+ export { A as AsVoidFunctions, E as EventHandlerOptions, S as ScriptInstance, d as UseFunctionType, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.H9K4hNc3.js';
3
+ export { u as useScript } from './shared/unhead.f-vxWgdH.js';
4
4
  import 'hookable';
5
5
 
6
6
  declare function createSpyProxy<T extends Record<string, any> | any[]>(target: T, onApply: (stack: RecordingEntry[][]) => void): T;
package/dist/server.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { am as Head, m as CreateServerHeadOptions, p as Unhead, s as RenderSSRHeadOptions, r as SSRHeadPayload, an as ResolvedHead, aB as HeadTag } from './shared/unhead.B4pP8_2D.mjs';
1
+ import { am as ResolvableHead, m as CreateServerHeadOptions, p as Unhead, s as RenderSSRHeadOptions, r as SSRHeadPayload, an as ResolvedHead, aC as HeadTag } from './shared/unhead.H9K4hNc3.mjs';
2
2
  import 'hookable';
3
3
 
4
- declare function createHead<T = Head>(options?: CreateServerHeadOptions): Unhead<T>;
4
+ declare function createHead<T = ResolvableHead>(options?: CreateServerHeadOptions): Unhead<T>;
5
5
 
6
6
  declare function renderSSRHead(head: Unhead<any>, options?: RenderSSRHeadOptions): Promise<SSRHeadPayload>;
7
7
 
package/dist/server.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { am as Head, m as CreateServerHeadOptions, p as Unhead, s as RenderSSRHeadOptions, r as SSRHeadPayload, an as ResolvedHead, aB as HeadTag } from './shared/unhead.B4pP8_2D.js';
1
+ import { am as ResolvableHead, m as CreateServerHeadOptions, p as Unhead, s as RenderSSRHeadOptions, r as SSRHeadPayload, an as ResolvedHead, aC as HeadTag } from './shared/unhead.H9K4hNc3.js';
2
2
  import 'hookable';
3
3
 
4
- declare function createHead<T = Head>(options?: CreateServerHeadOptions): Unhead<T>;
4
+ declare function createHead<T = ResolvableHead>(options?: CreateServerHeadOptions): Unhead<T>;
5
5
 
6
6
  declare function renderSSRHead(head: Unhead<any>, options?: RenderSSRHeadOptions): Promise<SSRHeadPayload>;
7
7
 
package/dist/server.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createHeadCore } from './shared/unhead.x5NJGkxU.mjs';
1
+ import { c as createHeadCore } from './shared/unhead.kC9yNSGl.mjs';
2
2
  import { T as TagsWithInnerContent, S as SelfClosingTags$1 } from './shared/unhead.yem5I2v_.mjs';
3
3
  import 'hookable';
4
4
  import './shared/unhead.xsi8MZXD.mjs';
@@ -204,7 +204,7 @@ async function renderSSRHead(head, options) {
204
204
 
205
205
  async function transformHtmlTemplate(head, html, options) {
206
206
  const { html: parsedHtml, input } = extractUnheadInputFromHtml(html);
207
- head.entries.set(0, { _i: 0, input, options: {} });
207
+ head.push(input, { _index: 0 });
208
208
  const headHtml = await renderSSRHead(head, options);
209
209
  return parsedHtml.replace("<html>", `<html${headHtml.htmlAttrs}>`).replace("<body>", `<body>${headHtml.bodyTagsOpen ? `
210
210
  ${headHtml.bodyTagsOpen}` : ``}`).replace("<body>", `<body${headHtml.bodyAttrs}>`).replace("</head>", `${headHtml.headTags}</head>`).replace("</body>", `${headHtml.bodyTags}</body>`);
@@ -1,4 +1,4 @@
1
- import { p as Unhead, c as UseScriptInput, e as UseScriptOptions, f as UseScriptReturn } from './unhead.B4pP8_2D.mjs';
1
+ import { p as Unhead, c as UseScriptInput, e as UseScriptOptions, f as UseScriptReturn } from './unhead.H9K4hNc3.mjs';
2
2
 
3
3
  /**
4
4
  * Load third-party scripts with SSR support and a proxied API.
@@ -1,4 +1,4 @@
1
- import { am as Head, aL as ResolvableValue, aM as ResolvableProperties, L as LinkBase, G as DataKeys, O as SchemaAugmentations, _ as BaseMeta, a6 as Style, J as ScriptBase, a8 as Noscript, a9 as HtmlAttributes, aa as BodyAttributes } from './unhead.B4pP8_2D.js';
1
+ import { am as ResolvableHead, aM as ResolvableValue, aN as ResolvableProperties, L as LinkBase, G as DataKeys, O as SchemaAugmentations, _ as BaseMeta, a6 as Style, J as ScriptBase, a8 as Noscript, a9 as HtmlAttributes, aa as BodyAttributes } from './unhead.H9K4hNc3.js';
2
2
 
3
3
  type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributes, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
4
4
  type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
@@ -7,7 +7,7 @@ type SafeLink = ResolvableProperties<Pick<LinkBase, 'id' | 'color' | 'crossorigi
7
7
  type SafeScript = ResolvableProperties<Pick<ScriptBase, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & SchemaAugmentations['script']>;
8
8
  type SafeNoscript = ResolvableProperties<Pick<Noscript, 'id' | 'textContent'> & DataKeys & SchemaAugmentations['noscript']>;
9
9
  type SafeStyle = ResolvableProperties<Pick<Style, 'id' | 'media' | 'textContent' | 'nonce' | 'title' | 'blocking'> & DataKeys & SchemaAugmentations['style']>;
10
- interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParams'> {
10
+ interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
11
11
  /**
12
12
  * The `<link>` HTML element specifies relationships between the current document and an external resource.
13
13
  * This element is most commonly used to link to stylesheets, but is also used to establish site icons
@@ -1,4 +1,4 @@
1
- import { am as Head, aL as ResolvableValue, aM as ResolvableProperties, L as LinkBase, G as DataKeys, O as SchemaAugmentations, _ as BaseMeta, a6 as Style, J as ScriptBase, a8 as Noscript, a9 as HtmlAttributes, aa as BodyAttributes } from './unhead.B4pP8_2D.mjs';
1
+ import { am as ResolvableHead, aM as ResolvableValue, aN as ResolvableProperties, L as LinkBase, G as DataKeys, O as SchemaAugmentations, _ as BaseMeta, a6 as Style, J as ScriptBase, a8 as Noscript, a9 as HtmlAttributes, aa as BodyAttributes } from './unhead.H9K4hNc3.mjs';
2
2
 
3
3
  type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributes, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
4
4
  type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
@@ -7,7 +7,7 @@ type SafeLink = ResolvableProperties<Pick<LinkBase, 'id' | 'color' | 'crossorigi
7
7
  type SafeScript = ResolvableProperties<Pick<ScriptBase, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & SchemaAugmentations['script']>;
8
8
  type SafeNoscript = ResolvableProperties<Pick<Noscript, 'id' | 'textContent'> & DataKeys & SchemaAugmentations['noscript']>;
9
9
  type SafeStyle = ResolvableProperties<Pick<Style, 'id' | 'media' | 'textContent' | 'nonce' | 'title' | 'blocking'> & DataKeys & SchemaAugmentations['style']>;
10
- interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParams'> {
10
+ interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
11
11
  /**
12
12
  * The `<link>` HTML element specifies relationships between the current document and an external resource.
13
13
  * This element is most commonly used to link to stylesheets, but is also used to establish site icons
@@ -65,31 +65,42 @@ const DeprecationsPlugin = /* @__PURE__ */ defineHeadPlugin({
65
65
  }
66
66
  });
67
67
 
68
- async function resolvePromisesRecursively(root) {
69
- if (root instanceof Promise) {
70
- return await root;
68
+ async function walkPromises(v) {
69
+ const type = typeof v;
70
+ if (type === "function") {
71
+ return v;
71
72
  }
72
- if (Array.isArray(root)) {
73
- return Promise.all(root.map((r) => resolvePromisesRecursively(r)));
73
+ if (v instanceof Promise) {
74
+ return await v;
74
75
  }
75
- if (typeof root === "object") {
76
- const resolved = {};
77
- for (const k in root) {
78
- if (!Object.hasOwn(root, k))
79
- continue;
80
- resolved[k] = await resolvePromisesRecursively(root[k]);
76
+ if (Array.isArray(v)) {
77
+ return await Promise.all(v.map((r) => walkPromises(r)));
78
+ }
79
+ if (v?.constructor === Object) {
80
+ const next = {};
81
+ for (const key of Object.keys(v)) {
82
+ next[key] = await walkPromises(v[key]);
81
83
  }
82
- return resolved;
84
+ return next;
83
85
  }
84
- return root;
86
+ return v;
85
87
  }
86
88
  const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({
87
89
  key: "promises",
88
90
  hooks: {
89
91
  "entries:resolve": async (ctx) => {
92
+ const promises = [];
90
93
  for (const k in ctx.entries) {
91
- ctx.entries[k].input = await resolvePromisesRecursively(ctx.entries[k].input);
94
+ if (!ctx.entries[k]._promisesProcessed) {
95
+ promises.push(
96
+ walkPromises(ctx.entries[k].input).then((val) => {
97
+ ctx.entries[k].input = val;
98
+ ctx.entries[k]._promisesProcessed = true;
99
+ })
100
+ );
101
+ }
92
102
  }
103
+ await Promise.all(promises);
93
104
  }
94
105
  }
95
106
  });
@@ -1849,7 +1849,7 @@ interface HeadUtils {
1849
1849
  */
1850
1850
  templateParams?: TemplateParams;
1851
1851
  }
1852
- interface Head<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
1852
+ interface ResolvableHead<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
1853
1853
  /**
1854
1854
  * The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
1855
1855
  * It only contains text; tags within the element are ignored.
@@ -1922,11 +1922,12 @@ interface ResolvedHead<E extends MergeHead = ResolvedSchemaAugmentations> extend
1922
1922
  htmlAttrs?: ResolvedHtmlAttributes<E['htmlAttrs']>;
1923
1923
  bodyAttrs?: ResolvedBodyAttributes<E['bodyAttrs']>;
1924
1924
  }
1925
+ type Head = ResolvableHead & ResolvedHead;
1925
1926
  type UseSeoMetaInput = MetaFlatInput & {
1926
1927
  title?: Title;
1927
1928
  titleTemplate?: TitleTemplate;
1928
1929
  };
1929
- type UseHeadInput<T extends MergeHead = MergeHead> = Head<T>;
1930
+ type UseHeadInput<T extends MergeHead = MergeHead> = ResolvableHead<T>;
1930
1931
 
1931
1932
  interface ResolvesDuplicates {
1932
1933
  /**
@@ -1981,7 +1982,7 @@ interface TagPriority {
1981
1982
  tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
1982
1983
  }
1983
1984
  type TagUserProperties = ResolvableProperties<TagPriority & TagPosition & InnerContent & ResolvesDuplicates & ProcessesTemplateParams>;
1984
- type TagKey = keyof Head;
1985
+ type TagKey = keyof ResolvableHead;
1985
1986
  type TemplateParams = {
1986
1987
  separator?: '|' | '-' | '·' | string;
1987
1988
  } & Record<string, null | string | Record<string, string>>;
@@ -2162,6 +2163,10 @@ interface HeadEntry<Input> {
2162
2163
  * @internal
2163
2164
  */
2164
2165
  _tags?: HeadTag[];
2166
+ /**
2167
+ * @internal
2168
+ */
2169
+ _promisesProcessed?: boolean;
2165
2170
  }
2166
2171
  type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'>;
2167
2172
  type HeadPluginInput = (HeadPluginOptions & {
@@ -2191,7 +2196,7 @@ interface ActiveHeadEntry<Input> {
2191
2196
  /**
2192
2197
  * @internal
2193
2198
  */
2194
- _poll: () => void;
2199
+ _poll: (rm?: boolean) => void;
2195
2200
  }
2196
2201
  type PropResolver = (key: string, value: any, tag?: HeadTag) => any;
2197
2202
  interface CreateHeadOptions {
@@ -2203,7 +2208,7 @@ interface CreateHeadOptions {
2203
2208
  *
2204
2209
  * Any tags here are added with low priority.
2205
2210
  */
2206
- init?: (Head<any> | undefined)[];
2211
+ init?: (ResolvableHead<any> | undefined)[];
2207
2212
  /**
2208
2213
  * Disable the Capo.js tag sorting algorithm.
2209
2214
  *
@@ -2233,14 +2238,21 @@ interface CreateClientHeadOptions extends CreateHeadOptions {
2233
2238
  domOptions?: DomPluginOptions;
2234
2239
  }
2235
2240
  interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams, ResolvesDuplicates {
2241
+ /**
2242
+ * @deprecated Tree shaking should now be handled using import.meta.* if statements.
2243
+ */
2236
2244
  mode?: RuntimeMode;
2237
2245
  head?: Unhead;
2238
2246
  /**
2239
2247
  * @internal
2240
2248
  */
2241
2249
  _safe?: boolean;
2250
+ /**
2251
+ * @internal
2252
+ */
2253
+ _index?: number;
2242
2254
  }
2243
- interface Unhead<Input = Head> {
2255
+ interface Unhead<Input = ResolvableHead> {
2244
2256
  /**
2245
2257
  * Registered plugins.
2246
2258
  */
@@ -2322,4 +2334,4 @@ interface DomState {
2322
2334
  elMap: Map<string, Element | Element[]>;
2323
2335
  }
2324
2336
 
2325
- export type { EntryAugmentation as $, AsVoidFunctions as A, DomPluginOptions as B, CreateHeadOptions as C, DomState as D, EventHandlerOptions as E, BodyEvents as F, DataKeys as G, HeadEntry as H, HttpEventAttributes as I, ScriptBase as J, UserTagConfigWithoutInnerContent as K, LinkBase as L, MetaFlatInput as M, UserAttributesConfig as N, SchemaAugmentations as O, PropResolver as P, ResolvedSchemaAugmentations as Q, RecordingEntry as R, ScriptInstance as S, MaybeArray as T, UseScriptStatus as U, BaseBodyAttr as V, WarmupStrategy as W, BaseHtmlAttr as X, BodyAttr as Y, HtmlAttr as Z, BaseMeta as _, UseScriptContext as a, MaybeEventFnHandlers as a0, Title as a1, TitleTemplate as a2, Base as a3, Link as a4, Meta as a5, Style as a6, Script as a7, Noscript as a8, HtmlAttributes as a9, HasTemplateParams as aA, HeadTag as aB, HeadTagKeys as aC, Booleanable as aD, Stringable as aE, Arrayable as aF, DefinedValueOrEmptyObject as aG, Merge as aH, MergeHead as aI, Never as aJ, Falsey as aK, ResolvableValue as aL, ResolvableProperties as aM, ResolvableUnion as aN, DeepResolvableProperties as aO, ResolvedMetaFlat as aP, BodyAttributes as aa, ResolvedTitle as ab, ResolvedTitleTemplate as ac, ResolvedBase as ad, ResolvedLink as ae, ResolvedMeta as af, ResolvedStyle as ag, ResolvedScript as ah, ResolvedNoscript as ai, ResolvedHtmlAttributes as aj, ResolvedBodyAttributes as ak, HeadUtils as al, Head as am, ResolvedHead as an, UseSeoMetaInput as ao, UseHeadInput as ap, ResolvesDuplicates as aq, ValidTagPositions as ar, TagPosition as as, InnerContentVal as at, InnerContent as au, TagPriority as av, TagUserProperties as aw, TagKey as ax, TemplateParams as ay, ProcessesTemplateParams as az, UseScriptResolvedInput as b, UseScriptInput as c, UseFunctionType as d, UseScriptOptions as e, UseScriptReturn as f, SideEffectsRecord as g, RuntimeMode as h, HeadPluginOptions as i, HeadPluginInput as j, HeadPlugin as k, ActiveHeadEntry as l, CreateServerHeadOptions as m, CreateClientHeadOptions as n, HeadEntryOptions as o, Unhead as p, HookResult as q, SSRHeadPayload as r, RenderSSRHeadOptions as s, EntryResolveCtx as t, DomRenderTagContext as u, DomBeforeRenderCtx as v, ShouldRenderContext as w, SSRRenderContext as x, HeadHooks as y, RenderDomHeadOptions as z };
2337
+ export type { EntryAugmentation as $, AsVoidFunctions as A, DomPluginOptions as B, CreateHeadOptions as C, DomState as D, EventHandlerOptions as E, BodyEvents as F, DataKeys as G, HeadEntry as H, HttpEventAttributes as I, ScriptBase as J, UserTagConfigWithoutInnerContent as K, LinkBase as L, MetaFlatInput as M, UserAttributesConfig as N, SchemaAugmentations as O, PropResolver as P, ResolvedSchemaAugmentations as Q, RecordingEntry as R, ScriptInstance as S, MaybeArray as T, UseScriptStatus as U, BaseBodyAttr as V, WarmupStrategy as W, BaseHtmlAttr as X, BodyAttr as Y, HtmlAttr as Z, BaseMeta as _, UseScriptContext as a, MaybeEventFnHandlers as a0, Title as a1, TitleTemplate as a2, Base as a3, Link as a4, Meta as a5, Style as a6, Script as a7, Noscript as a8, HtmlAttributes as a9, ProcessesTemplateParams as aA, HasTemplateParams as aB, HeadTag as aC, HeadTagKeys as aD, Booleanable as aE, Stringable as aF, Arrayable as aG, DefinedValueOrEmptyObject as aH, Merge as aI, MergeHead as aJ, Never as aK, Falsey as aL, ResolvableValue as aM, ResolvableProperties as aN, ResolvableUnion as aO, DeepResolvableProperties as aP, ResolvedMetaFlat as aQ, BodyAttributes as aa, ResolvedTitle as ab, ResolvedTitleTemplate as ac, ResolvedBase as ad, ResolvedLink as ae, ResolvedMeta as af, ResolvedStyle as ag, ResolvedScript as ah, ResolvedNoscript as ai, ResolvedHtmlAttributes as aj, ResolvedBodyAttributes as ak, HeadUtils as al, ResolvableHead as am, ResolvedHead as an, Head as ao, UseSeoMetaInput as ap, UseHeadInput as aq, ResolvesDuplicates as ar, ValidTagPositions as as, TagPosition as at, InnerContentVal as au, InnerContent as av, TagPriority as aw, TagUserProperties as ax, TagKey as ay, TemplateParams as az, UseScriptResolvedInput as b, UseScriptInput as c, UseFunctionType as d, UseScriptOptions as e, UseScriptReturn as f, SideEffectsRecord as g, RuntimeMode as h, HeadPluginOptions as i, HeadPluginInput as j, HeadPlugin as k, ActiveHeadEntry as l, CreateServerHeadOptions as m, CreateClientHeadOptions as n, HeadEntryOptions as o, Unhead as p, HookResult as q, SSRHeadPayload as r, RenderSSRHeadOptions as s, EntryResolveCtx as t, DomRenderTagContext as u, DomBeforeRenderCtx as v, ShouldRenderContext as w, SSRRenderContext as x, HeadHooks as y, RenderDomHeadOptions as z };
@@ -1849,7 +1849,7 @@ interface HeadUtils {
1849
1849
  */
1850
1850
  templateParams?: TemplateParams;
1851
1851
  }
1852
- interface Head<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
1852
+ interface ResolvableHead<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
1853
1853
  /**
1854
1854
  * The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
1855
1855
  * It only contains text; tags within the element are ignored.
@@ -1922,11 +1922,12 @@ interface ResolvedHead<E extends MergeHead = ResolvedSchemaAugmentations> extend
1922
1922
  htmlAttrs?: ResolvedHtmlAttributes<E['htmlAttrs']>;
1923
1923
  bodyAttrs?: ResolvedBodyAttributes<E['bodyAttrs']>;
1924
1924
  }
1925
+ type Head = ResolvableHead & ResolvedHead;
1925
1926
  type UseSeoMetaInput = MetaFlatInput & {
1926
1927
  title?: Title;
1927
1928
  titleTemplate?: TitleTemplate;
1928
1929
  };
1929
- type UseHeadInput<T extends MergeHead = MergeHead> = Head<T>;
1930
+ type UseHeadInput<T extends MergeHead = MergeHead> = ResolvableHead<T>;
1930
1931
 
1931
1932
  interface ResolvesDuplicates {
1932
1933
  /**
@@ -1981,7 +1982,7 @@ interface TagPriority {
1981
1982
  tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
1982
1983
  }
1983
1984
  type TagUserProperties = ResolvableProperties<TagPriority & TagPosition & InnerContent & ResolvesDuplicates & ProcessesTemplateParams>;
1984
- type TagKey = keyof Head;
1985
+ type TagKey = keyof ResolvableHead;
1985
1986
  type TemplateParams = {
1986
1987
  separator?: '|' | '-' | '·' | string;
1987
1988
  } & Record<string, null | string | Record<string, string>>;
@@ -2162,6 +2163,10 @@ interface HeadEntry<Input> {
2162
2163
  * @internal
2163
2164
  */
2164
2165
  _tags?: HeadTag[];
2166
+ /**
2167
+ * @internal
2168
+ */
2169
+ _promisesProcessed?: boolean;
2165
2170
  }
2166
2171
  type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'>;
2167
2172
  type HeadPluginInput = (HeadPluginOptions & {
@@ -2191,7 +2196,7 @@ interface ActiveHeadEntry<Input> {
2191
2196
  /**
2192
2197
  * @internal
2193
2198
  */
2194
- _poll: () => void;
2199
+ _poll: (rm?: boolean) => void;
2195
2200
  }
2196
2201
  type PropResolver = (key: string, value: any, tag?: HeadTag) => any;
2197
2202
  interface CreateHeadOptions {
@@ -2203,7 +2208,7 @@ interface CreateHeadOptions {
2203
2208
  *
2204
2209
  * Any tags here are added with low priority.
2205
2210
  */
2206
- init?: (Head<any> | undefined)[];
2211
+ init?: (ResolvableHead<any> | undefined)[];
2207
2212
  /**
2208
2213
  * Disable the Capo.js tag sorting algorithm.
2209
2214
  *
@@ -2233,14 +2238,21 @@ interface CreateClientHeadOptions extends CreateHeadOptions {
2233
2238
  domOptions?: DomPluginOptions;
2234
2239
  }
2235
2240
  interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams, ResolvesDuplicates {
2241
+ /**
2242
+ * @deprecated Tree shaking should now be handled using import.meta.* if statements.
2243
+ */
2236
2244
  mode?: RuntimeMode;
2237
2245
  head?: Unhead;
2238
2246
  /**
2239
2247
  * @internal
2240
2248
  */
2241
2249
  _safe?: boolean;
2250
+ /**
2251
+ * @internal
2252
+ */
2253
+ _index?: number;
2242
2254
  }
2243
- interface Unhead<Input = Head> {
2255
+ interface Unhead<Input = ResolvableHead> {
2244
2256
  /**
2245
2257
  * Registered plugins.
2246
2258
  */
@@ -2322,4 +2334,4 @@ interface DomState {
2322
2334
  elMap: Map<string, Element | Element[]>;
2323
2335
  }
2324
2336
 
2325
- export type { EntryAugmentation as $, AsVoidFunctions as A, DomPluginOptions as B, CreateHeadOptions as C, DomState as D, EventHandlerOptions as E, BodyEvents as F, DataKeys as G, HeadEntry as H, HttpEventAttributes as I, ScriptBase as J, UserTagConfigWithoutInnerContent as K, LinkBase as L, MetaFlatInput as M, UserAttributesConfig as N, SchemaAugmentations as O, PropResolver as P, ResolvedSchemaAugmentations as Q, RecordingEntry as R, ScriptInstance as S, MaybeArray as T, UseScriptStatus as U, BaseBodyAttr as V, WarmupStrategy as W, BaseHtmlAttr as X, BodyAttr as Y, HtmlAttr as Z, BaseMeta as _, UseScriptContext as a, MaybeEventFnHandlers as a0, Title as a1, TitleTemplate as a2, Base as a3, Link as a4, Meta as a5, Style as a6, Script as a7, Noscript as a8, HtmlAttributes as a9, HasTemplateParams as aA, HeadTag as aB, HeadTagKeys as aC, Booleanable as aD, Stringable as aE, Arrayable as aF, DefinedValueOrEmptyObject as aG, Merge as aH, MergeHead as aI, Never as aJ, Falsey as aK, ResolvableValue as aL, ResolvableProperties as aM, ResolvableUnion as aN, DeepResolvableProperties as aO, ResolvedMetaFlat as aP, BodyAttributes as aa, ResolvedTitle as ab, ResolvedTitleTemplate as ac, ResolvedBase as ad, ResolvedLink as ae, ResolvedMeta as af, ResolvedStyle as ag, ResolvedScript as ah, ResolvedNoscript as ai, ResolvedHtmlAttributes as aj, ResolvedBodyAttributes as ak, HeadUtils as al, Head as am, ResolvedHead as an, UseSeoMetaInput as ao, UseHeadInput as ap, ResolvesDuplicates as aq, ValidTagPositions as ar, TagPosition as as, InnerContentVal as at, InnerContent as au, TagPriority as av, TagUserProperties as aw, TagKey as ax, TemplateParams as ay, ProcessesTemplateParams as az, UseScriptResolvedInput as b, UseScriptInput as c, UseFunctionType as d, UseScriptOptions as e, UseScriptReturn as f, SideEffectsRecord as g, RuntimeMode as h, HeadPluginOptions as i, HeadPluginInput as j, HeadPlugin as k, ActiveHeadEntry as l, CreateServerHeadOptions as m, CreateClientHeadOptions as n, HeadEntryOptions as o, Unhead as p, HookResult as q, SSRHeadPayload as r, RenderSSRHeadOptions as s, EntryResolveCtx as t, DomRenderTagContext as u, DomBeforeRenderCtx as v, ShouldRenderContext as w, SSRRenderContext as x, HeadHooks as y, RenderDomHeadOptions as z };
2337
+ export type { EntryAugmentation as $, AsVoidFunctions as A, DomPluginOptions as B, CreateHeadOptions as C, DomState as D, EventHandlerOptions as E, BodyEvents as F, DataKeys as G, HeadEntry as H, HttpEventAttributes as I, ScriptBase as J, UserTagConfigWithoutInnerContent as K, LinkBase as L, MetaFlatInput as M, UserAttributesConfig as N, SchemaAugmentations as O, PropResolver as P, ResolvedSchemaAugmentations as Q, RecordingEntry as R, ScriptInstance as S, MaybeArray as T, UseScriptStatus as U, BaseBodyAttr as V, WarmupStrategy as W, BaseHtmlAttr as X, BodyAttr as Y, HtmlAttr as Z, BaseMeta as _, UseScriptContext as a, MaybeEventFnHandlers as a0, Title as a1, TitleTemplate as a2, Base as a3, Link as a4, Meta as a5, Style as a6, Script as a7, Noscript as a8, HtmlAttributes as a9, ProcessesTemplateParams as aA, HasTemplateParams as aB, HeadTag as aC, HeadTagKeys as aD, Booleanable as aE, Stringable as aF, Arrayable as aG, DefinedValueOrEmptyObject as aH, Merge as aI, MergeHead as aJ, Never as aK, Falsey as aL, ResolvableValue as aM, ResolvableProperties as aN, ResolvableUnion as aO, DeepResolvableProperties as aP, ResolvedMetaFlat as aQ, BodyAttributes as aa, ResolvedTitle as ab, ResolvedTitleTemplate as ac, ResolvedBase as ad, ResolvedLink as ae, ResolvedMeta as af, ResolvedStyle as ag, ResolvedScript as ah, ResolvedNoscript as ai, ResolvedHtmlAttributes as aj, ResolvedBodyAttributes as ak, HeadUtils as al, ResolvableHead as am, ResolvedHead as an, Head as ao, UseSeoMetaInput as ap, UseHeadInput as aq, ResolvesDuplicates as ar, ValidTagPositions as as, TagPosition as at, InnerContentVal as au, InnerContent as av, TagPriority as aw, TagUserProperties as ax, TagKey as ay, TemplateParams as az, UseScriptResolvedInput as b, UseScriptInput as c, UseFunctionType as d, UseScriptOptions as e, UseScriptReturn as f, SideEffectsRecord as g, RuntimeMode as h, HeadPluginOptions as i, HeadPluginInput as j, HeadPlugin as k, ActiveHeadEntry as l, CreateServerHeadOptions as m, CreateClientHeadOptions as n, HeadEntryOptions as o, Unhead as p, HookResult as q, SSRHeadPayload as r, RenderSSRHeadOptions as s, EntryResolveCtx as t, DomRenderTagContext as u, DomBeforeRenderCtx as v, ShouldRenderContext as w, SSRRenderContext as x, HeadHooks as y, RenderDomHeadOptions as z };
@@ -28,5 +28,17 @@ function useSeoMeta(unhead, input = {}, options) {
28
28
  }
29
29
  return entry;
30
30
  }
31
+ function useServerHead(unhead, input = {}, options = {}) {
32
+ options.mode = "server";
33
+ return unhead.push(input, options);
34
+ }
35
+ function useServerHeadSafe(unhead, input = {}, options = {}) {
36
+ options.mode = "server";
37
+ return useHeadSafe(unhead, input, { ...options, mode: "server" });
38
+ }
39
+ function useServerSeoMeta(unhead, input = {}, options) {
40
+ options.mode = "server";
41
+ return useSeoMeta(unhead, input, { ...options, mode: "server" });
42
+ }
31
43
 
32
- export { useHeadSafe as a, useSeoMeta as b, useHead as u };
44
+ export { useHeadSafe as a, useSeoMeta as b, useServerHead as c, useServerHeadSafe as d, useServerSeoMeta as e, useHead as u };
@@ -1,4 +1,4 @@
1
- import { p as Unhead, c as UseScriptInput, e as UseScriptOptions, f as UseScriptReturn } from './unhead.B4pP8_2D.js';
1
+ import { p as Unhead, c as UseScriptInput, e as UseScriptOptions, f as UseScriptReturn } from './unhead.H9K4hNc3.js';
2
2
 
3
3
  /**
4
4
  * Load third-party scripts with SSR support and a proxied API.
@@ -18,6 +18,7 @@ function createHeadCore(resolvedOptions = {}) {
18
18
  const ssr = !resolvedOptions.document;
19
19
  const entries = /* @__PURE__ */ new Map();
20
20
  const plugins = /* @__PURE__ */ new Map();
21
+ const normalizeQueue = [];
21
22
  const head = {
22
23
  _entryCount: 1,
23
24
  // 0 is reserved for internal use
@@ -34,25 +35,24 @@ function createHeadCore(resolvedOptions = {}) {
34
35
  push(input, _options = {}) {
35
36
  const options = { ..._options };
36
37
  delete options.head;
37
- const _i = head._entryCount++;
38
+ const _i = _options._index ?? head._entryCount++;
39
+ const inst = { _i, input, options };
38
40
  const _ = {
39
- _poll() {
41
+ _poll(rm = false) {
40
42
  head.dirty = true;
43
+ !rm && normalizeQueue.push(_i);
41
44
  hooks.callHook("entries:updated", head);
42
45
  },
43
46
  dispose() {
44
47
  if (entries.delete(_i)) {
45
- _._poll();
48
+ _._poll(true);
46
49
  }
47
50
  },
48
51
  // a patch is the same as creating a new entry, just a nice DX
49
52
  patch(input2) {
50
53
  if (!options.mode || options.mode === "server" && ssr || options.mode === "client" && !ssr) {
51
- entries.set(_i, {
52
- _i,
53
- input: input2,
54
- options
55
- });
54
+ inst.input = input2;
55
+ entries.set(_i, inst);
56
56
  _._poll();
57
57
  }
58
58
  }
@@ -67,22 +67,25 @@ function createHeadCore(resolvedOptions = {}) {
67
67
  entries: [...head.entries.values()]
68
68
  };
69
69
  await hooks.callHook("entries:resolve", ctx);
70
- const allTags = [];
71
- let hasFlatMeta = false;
72
- for (const e of ctx.entries) {
73
- const normalizeCtx = {
74
- tags: normalizeEntryToTags(e.input, resolvedOptions.propResolvers || []).map((t) => Object.assign(t, e.options)),
75
- entry: e
76
- };
77
- await hooks.callHook("entries:normalize", normalizeCtx);
78
- allTags.push(...normalizeCtx.tags.map((t, i) => {
79
- t._w = tagWeight(head, t);
80
- t._p = (e._i << 10) + i;
81
- t._d = dedupeKey(t);
82
- return t;
83
- }));
70
+ while (normalizeQueue.length) {
71
+ const i = normalizeQueue.shift();
72
+ const e = entries.get(i);
73
+ if (e) {
74
+ const normalizeCtx = {
75
+ tags: normalizeEntryToTags(e.input, resolvedOptions.propResolvers || []).map((t) => Object.assign(t, e.options)),
76
+ entry: e
77
+ };
78
+ await hooks.callHook("entries:normalize", normalizeCtx);
79
+ e._tags = normalizeCtx.tags.map((t, i2) => {
80
+ t._w = tagWeight(head, t);
81
+ t._p = (e._i << 10) + i2;
82
+ t._d = dedupeKey(t);
83
+ return t;
84
+ });
85
+ }
84
86
  }
85
- allTags.sort(sortTags).reduce((acc, next) => {
87
+ let hasFlatMeta = false;
88
+ ctx.entries.flatMap((e) => e._tags || []).sort(sortTags).reduce((acc, next) => {
86
89
  const k = String(next._d || next._p);
87
90
  if (!acc.has(k))
88
91
  return acc.set(k, next);
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { l as ActiveHeadEntry, aF as Arrayable, A as AsVoidFunctions, a3 as Base, V as BaseBodyAttr, X as BaseHtmlAttr, _ as BaseMeta, Y as BodyAttr, aa as BodyAttributes, F as BodyEvents, aD as Booleanable, n as CreateClientHeadOptions, C as CreateHeadOptions, m as CreateServerHeadOptions, G as DataKeys, aO as DeepResolvableProperties, aG as DefinedValueOrEmptyObject, v as DomBeforeRenderCtx, B as DomPluginOptions, u as DomRenderTagContext, D as DomState, $ as EntryAugmentation, t as EntryResolveCtx, E as EventHandlerOptions, aK as Falsey, aA as HasTemplateParams, am as Head, H as HeadEntry, o as HeadEntryOptions, y as HeadHooks, k as HeadPlugin, j as HeadPluginInput, i as HeadPluginOptions, aB as HeadTag, aC as HeadTagKeys, al as HeadUtils, q as HookResult, Z as HtmlAttr, a9 as HtmlAttributes, I as HttpEventAttributes, au as InnerContent, at as InnerContentVal, a4 as Link, L as LinkBase, T as MaybeArray, a0 as MaybeEventFnHandlers, aH as Merge, aI as MergeHead, a5 as Meta, M as MetaFlatInput, aJ as Never, a8 as Noscript, az as ProcessesTemplateParams, P as PropResolver, R as RecordingEntry, z as RenderDomHeadOptions, s as RenderSSRHeadOptions, aM as ResolvableProperties, aN as ResolvableUnion, aL as ResolvableValue, ad as ResolvedBase, ak as ResolvedBodyAttributes, an as ResolvedHead, aj as ResolvedHtmlAttributes, ae as ResolvedLink, af as ResolvedMeta, ai as ResolvedNoscript, Q as ResolvedSchemaAugmentations, ah as ResolvedScript, ag as ResolvedStyle, ab as ResolvedTitle, ac as ResolvedTitleTemplate, aq as ResolvesDuplicates, h as RuntimeMode, r as SSRHeadPayload, x as SSRRenderContext, O as SchemaAugmentations, a7 as Script, J as ScriptBase, S as ScriptInstance, w as ShouldRenderContext, g as SideEffectsRecord, aE as Stringable, a6 as Style, ax as TagKey, as as TagPosition, av as TagPriority, aw as TagUserProperties, ay as TemplateParams, a1 as Title, a2 as TitleTemplate, p as Unhead, d as UseFunctionType, ap as UseHeadInput, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, ao as UseSeoMetaInput, N as UserAttributesConfig, K as UserTagConfigWithoutInnerContent, ar as ValidTagPositions, W as WarmupStrategy } from './shared/unhead.B4pP8_2D.mjs';
2
- export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle } from './shared/unhead.B7BBWq8B.mjs';
3
- export { u as useScript } from './shared/unhead.DcPrZw2e.mjs';
1
+ export { l as ActiveHeadEntry, aG as Arrayable, A as AsVoidFunctions, a3 as Base, V as BaseBodyAttr, X as BaseHtmlAttr, _ as BaseMeta, Y as BodyAttr, aa as BodyAttributes, F as BodyEvents, aE as Booleanable, n as CreateClientHeadOptions, C as CreateHeadOptions, m as CreateServerHeadOptions, G as DataKeys, aP as DeepResolvableProperties, aH as DefinedValueOrEmptyObject, v as DomBeforeRenderCtx, B as DomPluginOptions, u as DomRenderTagContext, D as DomState, $ as EntryAugmentation, t as EntryResolveCtx, E as EventHandlerOptions, aL as Falsey, aB as HasTemplateParams, ao as Head, H as HeadEntry, o as HeadEntryOptions, y as HeadHooks, k as HeadPlugin, j as HeadPluginInput, i as HeadPluginOptions, aC as HeadTag, aD as HeadTagKeys, al as HeadUtils, q as HookResult, Z as HtmlAttr, a9 as HtmlAttributes, I as HttpEventAttributes, av as InnerContent, au as InnerContentVal, a4 as Link, L as LinkBase, T as MaybeArray, a0 as MaybeEventFnHandlers, aI as Merge, aJ as MergeHead, a5 as Meta, M as MetaFlatInput, aK as Never, a8 as Noscript, aA as ProcessesTemplateParams, P as PropResolver, R as RecordingEntry, z as RenderDomHeadOptions, s as RenderSSRHeadOptions, am as ResolvableHead, aN as ResolvableProperties, aO as ResolvableUnion, aM as ResolvableValue, ad as ResolvedBase, ak as ResolvedBodyAttributes, an as ResolvedHead, aj as ResolvedHtmlAttributes, ae as ResolvedLink, af as ResolvedMeta, ai as ResolvedNoscript, Q as ResolvedSchemaAugmentations, ah as ResolvedScript, ag as ResolvedStyle, ab as ResolvedTitle, ac as ResolvedTitleTemplate, ar as ResolvesDuplicates, h as RuntimeMode, r as SSRHeadPayload, x as SSRRenderContext, O as SchemaAugmentations, a7 as Script, J as ScriptBase, S as ScriptInstance, w as ShouldRenderContext, g as SideEffectsRecord, aF as Stringable, a6 as Style, ay as TagKey, at as TagPosition, aw as TagPriority, ax as TagUserProperties, az as TemplateParams, a1 as Title, a2 as TitleTemplate, p as Unhead, d as UseFunctionType, aq as UseHeadInput, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, ap as UseSeoMetaInput, N as UserAttributesConfig, K as UserTagConfigWithoutInnerContent, as as ValidTagPositions, W as WarmupStrategy } from './shared/unhead.H9K4hNc3.mjs';
2
+ export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle } from './shared/unhead.D5hDM0h5.mjs';
3
+ export { u as useScript } from './shared/unhead.CMEjo4Tf.mjs';
4
4
  export { createSpyProxy } from './scripts.mjs';
5
5
  import 'hookable';
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { l as ActiveHeadEntry, aF as Arrayable, A as AsVoidFunctions, a3 as Base, V as BaseBodyAttr, X as BaseHtmlAttr, _ as BaseMeta, Y as BodyAttr, aa as BodyAttributes, F as BodyEvents, aD as Booleanable, n as CreateClientHeadOptions, C as CreateHeadOptions, m as CreateServerHeadOptions, G as DataKeys, aO as DeepResolvableProperties, aG as DefinedValueOrEmptyObject, v as DomBeforeRenderCtx, B as DomPluginOptions, u as DomRenderTagContext, D as DomState, $ as EntryAugmentation, t as EntryResolveCtx, E as EventHandlerOptions, aK as Falsey, aA as HasTemplateParams, am as Head, H as HeadEntry, o as HeadEntryOptions, y as HeadHooks, k as HeadPlugin, j as HeadPluginInput, i as HeadPluginOptions, aB as HeadTag, aC as HeadTagKeys, al as HeadUtils, q as HookResult, Z as HtmlAttr, a9 as HtmlAttributes, I as HttpEventAttributes, au as InnerContent, at as InnerContentVal, a4 as Link, L as LinkBase, T as MaybeArray, a0 as MaybeEventFnHandlers, aH as Merge, aI as MergeHead, a5 as Meta, M as MetaFlatInput, aJ as Never, a8 as Noscript, az as ProcessesTemplateParams, P as PropResolver, R as RecordingEntry, z as RenderDomHeadOptions, s as RenderSSRHeadOptions, aM as ResolvableProperties, aN as ResolvableUnion, aL as ResolvableValue, ad as ResolvedBase, ak as ResolvedBodyAttributes, an as ResolvedHead, aj as ResolvedHtmlAttributes, ae as ResolvedLink, af as ResolvedMeta, ai as ResolvedNoscript, Q as ResolvedSchemaAugmentations, ah as ResolvedScript, ag as ResolvedStyle, ab as ResolvedTitle, ac as ResolvedTitleTemplate, aq as ResolvesDuplicates, h as RuntimeMode, r as SSRHeadPayload, x as SSRRenderContext, O as SchemaAugmentations, a7 as Script, J as ScriptBase, S as ScriptInstance, w as ShouldRenderContext, g as SideEffectsRecord, aE as Stringable, a6 as Style, ax as TagKey, as as TagPosition, av as TagPriority, aw as TagUserProperties, ay as TemplateParams, a1 as Title, a2 as TitleTemplate, p as Unhead, d as UseFunctionType, ap as UseHeadInput, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, ao as UseSeoMetaInput, N as UserAttributesConfig, K as UserTagConfigWithoutInnerContent, ar as ValidTagPositions, W as WarmupStrategy } from './shared/unhead.B4pP8_2D.js';
2
- export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle } from './shared/unhead.D_YYNboR.js';
3
- export { u as useScript } from './shared/unhead.CES0yIUs.js';
1
+ export { l as ActiveHeadEntry, aG as Arrayable, A as AsVoidFunctions, a3 as Base, V as BaseBodyAttr, X as BaseHtmlAttr, _ as BaseMeta, Y as BodyAttr, aa as BodyAttributes, F as BodyEvents, aE as Booleanable, n as CreateClientHeadOptions, C as CreateHeadOptions, m as CreateServerHeadOptions, G as DataKeys, aP as DeepResolvableProperties, aH as DefinedValueOrEmptyObject, v as DomBeforeRenderCtx, B as DomPluginOptions, u as DomRenderTagContext, D as DomState, $ as EntryAugmentation, t as EntryResolveCtx, E as EventHandlerOptions, aL as Falsey, aB as HasTemplateParams, ao as Head, H as HeadEntry, o as HeadEntryOptions, y as HeadHooks, k as HeadPlugin, j as HeadPluginInput, i as HeadPluginOptions, aC as HeadTag, aD as HeadTagKeys, al as HeadUtils, q as HookResult, Z as HtmlAttr, a9 as HtmlAttributes, I as HttpEventAttributes, av as InnerContent, au as InnerContentVal, a4 as Link, L as LinkBase, T as MaybeArray, a0 as MaybeEventFnHandlers, aI as Merge, aJ as MergeHead, a5 as Meta, M as MetaFlatInput, aK as Never, a8 as Noscript, aA as ProcessesTemplateParams, P as PropResolver, R as RecordingEntry, z as RenderDomHeadOptions, s as RenderSSRHeadOptions, am as ResolvableHead, aN as ResolvableProperties, aO as ResolvableUnion, aM as ResolvableValue, ad as ResolvedBase, ak as ResolvedBodyAttributes, an as ResolvedHead, aj as ResolvedHtmlAttributes, ae as ResolvedLink, af as ResolvedMeta, ai as ResolvedNoscript, Q as ResolvedSchemaAugmentations, ah as ResolvedScript, ag as ResolvedStyle, ab as ResolvedTitle, ac as ResolvedTitleTemplate, ar as ResolvesDuplicates, h as RuntimeMode, r as SSRHeadPayload, x as SSRRenderContext, O as SchemaAugmentations, a7 as Script, J as ScriptBase, S as ScriptInstance, w as ShouldRenderContext, g as SideEffectsRecord, aF as Stringable, a6 as Style, ay as TagKey, at as TagPosition, aw as TagPriority, ax as TagUserProperties, az as TemplateParams, a1 as Title, a2 as TitleTemplate, p as Unhead, d as UseFunctionType, aq as UseHeadInput, a as UseScriptContext, c as UseScriptInput, e as UseScriptOptions, b as UseScriptResolvedInput, f as UseScriptReturn, U as UseScriptStatus, ap as UseSeoMetaInput, N as UserAttributesConfig, K as UserTagConfigWithoutInnerContent, as as ValidTagPositions, W as WarmupStrategy } from './shared/unhead.H9K4hNc3.js';
2
+ export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle } from './shared/unhead.CYOiVxYm.js';
3
+ export { u as useScript } from './shared/unhead.f-vxWgdH.js';
4
4
  export { createSpyProxy } from './scripts.js';
5
5
  import 'hookable';
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { aB as HeadTag, _ as BaseMeta, aP as ResolvedMetaFlat, am as Head, P as PropResolver, p as Unhead, ay as TemplateParams } from './shared/unhead.B4pP8_2D.mjs';
1
+ import { aC as HeadTag, _ as BaseMeta, aQ as ResolvedMetaFlat, am as ResolvableHead, P as PropResolver, p as Unhead, az as TemplateParams } from './shared/unhead.H9K4hNc3.mjs';
2
2
  import 'hookable';
3
3
 
4
4
  declare const SelfClosingTags: Set<string>;
@@ -19,7 +19,7 @@ declare function hashTag(tag: HeadTag): string;
19
19
  declare function resolveMetaKeyType(key: string): keyof BaseMeta;
20
20
  declare function resolveMetaKeyValue(key: string): string;
21
21
  declare function resolvePackedMetaObjectValue(value: string, key: string): string;
22
- declare function unpackMeta<T extends ResolvedMetaFlat>(input: T): Required<Head>['meta'];
22
+ declare function unpackMeta<T extends ResolvedMetaFlat>(input: T): Required<ResolvableHead>['meta'];
23
23
 
24
24
  declare function normalizeProps(tag: HeadTag, input: Record<string, any>): HeadTag;
25
25
  declare function normalizeEntryToTags(input: any, propResolvers: PropResolver[]): HeadTag[];
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { aB as HeadTag, _ as BaseMeta, aP as ResolvedMetaFlat, am as Head, P as PropResolver, p as Unhead, ay as TemplateParams } from './shared/unhead.B4pP8_2D.js';
1
+ import { aC as HeadTag, _ as BaseMeta, aQ as ResolvedMetaFlat, am as ResolvableHead, P as PropResolver, p as Unhead, az as TemplateParams } from './shared/unhead.H9K4hNc3.js';
2
2
  import 'hookable';
3
3
 
4
4
  declare const SelfClosingTags: Set<string>;
@@ -19,7 +19,7 @@ declare function hashTag(tag: HeadTag): string;
19
19
  declare function resolveMetaKeyType(key: string): keyof BaseMeta;
20
20
  declare function resolveMetaKeyValue(key: string): string;
21
21
  declare function resolvePackedMetaObjectValue(value: string, key: string): string;
22
- declare function unpackMeta<T extends ResolvedMetaFlat>(input: T): Required<Head>['meta'];
22
+ declare function unpackMeta<T extends ResolvedMetaFlat>(input: T): Required<ResolvableHead>['meta'];
23
23
 
24
24
  declare function normalizeProps(tag: HeadTag, input: Record<string, any>): HeadTag;
25
25
  declare function normalizeEntryToTags(input: any, propResolvers: PropResolver[]): HeadTag[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "2.0.0-alpha.22",
4
+ "version": "2.0.0-alpha.24",
5
5
  "description": "Full-stack <head> manager built for any framework.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",