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 +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.mjs +1 -1
- package/dist/index.d.mts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/index.mjs +2 -2
- package/dist/legacy.d.mts +6 -6
- package/dist/legacy.d.ts +6 -6
- package/dist/legacy.mjs +3 -3
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.mjs +9 -9
- package/dist/scripts.d.mts +3 -3
- package/dist/scripts.d.ts +3 -3
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.mjs +2 -2
- package/dist/shared/{unhead.DcPrZw2e.d.mts → unhead.CMEjo4Tf.d.mts} +1 -1
- package/dist/shared/{unhead.D_YYNboR.d.ts → unhead.CYOiVxYm.d.ts} +2 -2
- package/dist/shared/{unhead.B7BBWq8B.d.mts → unhead.D5hDM0h5.d.mts} +2 -2
- package/dist/shared/{unhead.9Qw6eOEM.mjs → unhead.Dl6vXegp.mjs} +25 -14
- package/dist/shared/{unhead.B4pP8_2D.d.mts → unhead.H9K4hNc3.d.mts} +19 -7
- package/dist/shared/{unhead.B4pP8_2D.d.ts → unhead.H9K4hNc3.d.ts} +19 -7
- package/dist/shared/{unhead.C2emW6l4.mjs → unhead.PEkM8z0l.mjs} +13 -1
- package/dist/shared/{unhead.CES0yIUs.d.ts → unhead.f-vxWgdH.d.ts} +1 -1
- package/dist/shared/{unhead.x5NJGkxU.mjs → unhead.kC9yNSGl.mjs} +26 -23
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { am as
|
|
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 =
|
|
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
|
|
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 =
|
|
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.
|
|
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.
|
|
2
|
-
import { p as Unhead, o as HeadEntryOptions, l as ActiveHeadEntry,
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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 =
|
|
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.
|
|
2
|
-
import { p as Unhead, o as HeadEntryOptions, l as ActiveHeadEntry,
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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 =
|
|
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.
|
|
2
|
-
export { c as createHeadCore } from './shared/unhead.
|
|
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
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
4
|
-
import './shared/unhead.
|
|
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> =
|
|
12
|
-
declare function createHead<T extends Record<string, any> =
|
|
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
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
4
|
-
import './shared/unhead.
|
|
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> =
|
|
12
|
-
declare function createHead<T extends Record<string, any> =
|
|
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.
|
|
2
|
-
import { D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin } from './shared/unhead.
|
|
3
|
-
export { u as useHead, a as useHeadSafe, b as useSeoMeta } from './shared/unhead.
|
|
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';
|
package/dist/plugins.d.mts
CHANGED
package/dist/plugins.d.ts
CHANGED
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.
|
|
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
|
-
|
|
61
|
-
|
|
59
|
+
"property": "og:title",
|
|
60
|
+
"tagPriority": "low",
|
|
61
|
+
"data-infer": ""
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
property: "og:description",
|
|
65
|
-
|
|
66
|
-
|
|
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
|
|
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
|
|
85
|
+
if (typeof ogDescription?.props["data-infer"] !== "undefined") {
|
|
86
86
|
ogDescription.props.content = options.ogDescription ? options.ogDescription(description) : description || "";
|
|
87
87
|
}
|
|
88
88
|
}
|
package/dist/scripts.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as RecordingEntry } from './shared/unhead.
|
|
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.
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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.
|
|
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.
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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<
|
|
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
|
|
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<
|
|
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
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
async function walkPromises(v) {
|
|
69
|
+
const type = typeof v;
|
|
70
|
+
if (type === "function") {
|
|
71
|
+
return v;
|
|
71
72
|
}
|
|
72
|
-
if (
|
|
73
|
-
return
|
|
73
|
+
if (v instanceof Promise) {
|
|
74
|
+
return await v;
|
|
74
75
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
|
84
|
+
return next;
|
|
83
85
|
}
|
|
84
|
-
return
|
|
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
|
-
|
|
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
|
|
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> =
|
|
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
|
|
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?: (
|
|
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 =
|
|
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,
|
|
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
|
|
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> =
|
|
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
|
|
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?: (
|
|
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 =
|
|
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,
|
|
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.
|
|
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
|
-
|
|
52
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
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,
|
|
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.
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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,
|
|
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.
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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 {
|
|
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<
|
|
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 {
|
|
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<
|
|
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[];
|