unhead 3.0.2 → 3.0.3

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.
Files changed (47) hide show
  1. package/dist/client.d.mts +5 -5
  2. package/dist/client.d.ts +5 -5
  3. package/dist/client.mjs +6 -63
  4. package/dist/index.d.mts +6 -7
  5. package/dist/index.d.ts +6 -7
  6. package/dist/index.mjs +2 -1
  7. package/dist/legacy.d.mts +26 -0
  8. package/dist/legacy.d.ts +26 -0
  9. package/dist/legacy.mjs +63 -0
  10. package/dist/parser.d.mts +1 -1
  11. package/dist/parser.d.ts +1 -1
  12. package/dist/plugins.d.mts +2 -2
  13. package/dist/plugins.d.ts +2 -2
  14. package/dist/plugins.mjs +5 -129
  15. package/dist/scripts.d.mts +4 -4
  16. package/dist/scripts.d.ts +4 -4
  17. package/dist/server.d.mts +4 -4
  18. package/dist/server.d.ts +4 -4
  19. package/dist/shared/{unhead.D_bywjUE.mjs → unhead.A4ndrqqe.mjs} +2 -5
  20. package/dist/shared/{unhead.Dp1MlAYz.d.mts → unhead.BAm7OHQx.d.mts} +1 -1
  21. package/dist/shared/unhead.BHSg79VK.d.ts +6 -0
  22. package/dist/shared/{unhead.YGcEMcjf.d.ts → unhead.BPps6U7z.d.ts} +1 -1
  23. package/dist/shared/{unhead.BhElfVXO.d.ts → unhead.BTcZ161H.d.ts} +1 -1
  24. package/dist/shared/unhead.BdWlwKav.d.mts +6 -0
  25. package/dist/shared/{unhead.D4KaR-FM.d.ts → unhead.BkiQF63F.d.ts} +2 -2
  26. package/dist/shared/unhead.CH30252c.mjs +129 -0
  27. package/dist/shared/{unhead.DJ6joC2O.d.mts → unhead.CSqfLsrn.d.mts} +2 -2
  28. package/dist/shared/unhead.CUXLLRtV.mjs +5 -0
  29. package/dist/shared/{unhead.BRWMyYIW.d.ts → unhead.CZmLNN-R.d.ts} +1 -1
  30. package/dist/shared/{unhead.BJTN1X0i.d.mts → unhead.DBv5uRwR.d.mts} +39 -18
  31. package/dist/shared/{unhead.BJTN1X0i.d.ts → unhead.DBv5uRwR.d.ts} +39 -18
  32. package/dist/shared/{unhead.DsHmk_XC.d.mts → unhead.DFLvtb3Z.d.mts} +1 -1
  33. package/dist/shared/{unhead.CpT6Kxc0.d.ts → unhead.DMQDfSsC.d.ts} +2 -2
  34. package/dist/shared/{unhead.BXRLaj2l.d.mts → unhead.DR0woClT.d.mts} +1 -1
  35. package/dist/shared/{unhead.DH3TZMHc.d.ts → unhead.DeVAJflP.d.ts} +1 -1
  36. package/dist/shared/unhead.YnmwhfIN.mjs +64 -0
  37. package/dist/shared/{unhead.C6alnWbQ.d.mts → unhead.myNKutCo.d.mts} +2 -2
  38. package/dist/shared/{unhead.CZPkBynw.d.mts → unhead.vAjfKrQR.d.mts} +1 -1
  39. package/dist/stream/client.d.mts +3 -3
  40. package/dist/stream/client.d.ts +3 -3
  41. package/dist/stream/server.d.mts +3 -3
  42. package/dist/stream/server.d.ts +3 -3
  43. package/dist/types.d.mts +6 -6
  44. package/dist/types.d.ts +6 -6
  45. package/dist/utils.d.mts +2 -2
  46. package/dist/utils.d.ts +2 -2
  47. package/package.json +8 -1
package/dist/client.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- export { C as ClientUnhead, c as createHead } from './shared/unhead.DJ6joC2O.mjs';
2
- import { R as RenderDomHeadOptions } from './shared/unhead.BXRLaj2l.mjs';
3
- import { p as HeadRenderer, U as Unhead } from './shared/unhead.DsHmk_XC.mjs';
4
- export { c as CreateClientHeadOptions } from './shared/unhead.DsHmk_XC.mjs';
1
+ export { C as ClientUnhead, c as createHead } from './shared/unhead.CSqfLsrn.mjs';
2
+ import { R as RenderDomHeadOptions } from './shared/unhead.DR0woClT.mjs';
3
+ import { p as HeadRenderer, U as Unhead } from './shared/unhead.DFLvtb3Z.mjs';
4
+ export { c as CreateClientHeadOptions } from './shared/unhead.DFLvtb3Z.mjs';
5
5
  import 'hookable';
6
- import './shared/unhead.BJTN1X0i.mjs';
6
+ import './shared/unhead.DBv5uRwR.mjs';
7
7
 
8
8
  declare function createDomRenderer(options?: RenderDomHeadOptions): HeadRenderer<boolean>;
9
9
 
package/dist/client.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { C as ClientUnhead, c as createHead } from './shared/unhead.CpT6Kxc0.js';
2
- import { R as RenderDomHeadOptions } from './shared/unhead.YGcEMcjf.js';
3
- import { p as HeadRenderer, U as Unhead } from './shared/unhead.BRWMyYIW.js';
4
- export { c as CreateClientHeadOptions } from './shared/unhead.BRWMyYIW.js';
1
+ export { C as ClientUnhead, c as createHead } from './shared/unhead.DMQDfSsC.js';
2
+ import { R as RenderDomHeadOptions } from './shared/unhead.BPps6U7z.js';
3
+ import { p as HeadRenderer, U as Unhead } from './shared/unhead.CZmLNN-R.js';
4
+ export { c as CreateClientHeadOptions } from './shared/unhead.CZmLNN-R.js';
5
5
  import 'hookable';
6
- import './shared/unhead.BJTN1X0i.js';
6
+ import './shared/unhead.DBv5uRwR.js';
7
7
 
8
8
  declare function createDomRenderer(options?: RenderDomHeadOptions): HeadRenderer<boolean>;
9
9
 
package/dist/client.mjs CHANGED
@@ -1,68 +1,11 @@
1
- import { c as createDomRenderer, r as renderDOMHead$1 } from './shared/unhead.pv34ME7O.mjs';
2
- import { c as createUnhead, r as registerPlugin } from './shared/unhead.CfgPMHXt.mjs';
3
- import { c as createHooks } from './shared/unhead.DvIxXxuO.mjs';
1
+ import { r as renderDOMHead$1 } from './shared/unhead.pv34ME7O.mjs';
2
+ export { c as createDomRenderer } from './shared/unhead.pv34ME7O.mjs';
3
+ export { c as createHead } from './shared/unhead.YnmwhfIN.mjs';
4
4
  import './shared/unhead.fg-0ge_u.mjs';
5
5
  import './shared/unhead.DiRbsb3I.mjs';
6
+ import './shared/unhead.DvIxXxuO.mjs';
6
7
  import 'hookable';
7
-
8
- const P = { critical: -8, high: -1, low: 2 };
9
- const tagWeight = (tag) => typeof tag.tagPriority === "number" ? tag.tagPriority : 100 + (P[tag.tagPriority] || 0);
10
- function createHead(options = {}) {
11
- options.document = options.document || (typeof window !== "undefined" ? document : void 0);
12
- const renderer = options.render || createDomRenderer({ document: options.document });
13
- const initialPayload = options.document?.head.querySelector('script[id="unhead:payload"]')?.innerHTML || false;
14
- const core = createUnhead(renderer, { document: options.document, propResolvers: options.propResolvers, _tagWeight: tagWeight, init: [] });
15
- const hooks = createHooks(options.hooks);
16
- let dirty = false;
17
- const head = {
18
- ...core,
19
- ssr: false,
20
- hooks,
21
- use: (p) => registerPlugin(head, p),
22
- get dirty() {
23
- return dirty;
24
- },
25
- set dirty(v) {
26
- dirty = v;
27
- },
28
- render: () => renderer(head),
29
- invalidate() {
30
- for (const e of core.entries.values()) delete e._tags;
31
- dirty = true;
32
- hooks.callHook("entries:updated", head);
33
- },
34
- push(input, _options) {
35
- const onRendered = _options?.onRendered;
36
- const unhook = onRendered ? hooks.hook("dom:rendered", onRendered) : void 0;
37
- const active = core.push(input, _options);
38
- core.entries.get(active._i)._o = input;
39
- dirty = true;
40
- hooks.callHook("entries:updated", head);
41
- return {
42
- _i: active._i,
43
- patch(input2) {
44
- active.patch(input2);
45
- dirty = true;
46
- hooks.callHook("entries:updated", head);
47
- },
48
- dispose() {
49
- unhook?.();
50
- if (core.entries.has(active._i)) {
51
- active.dispose();
52
- head.invalidate();
53
- }
54
- }
55
- };
56
- }
57
- };
58
- hooks.hook("entries:updated", () => {
59
- renderer(head);
60
- });
61
- options.plugins?.forEach((p) => registerPlugin(head, p));
62
- initialPayload && head.push(JSON.parse(initialPayload));
63
- options.init?.forEach((e) => e && head.push(e));
64
- return head;
65
- }
8
+ import './shared/unhead.CfgPMHXt.mjs';
66
9
 
67
10
  function createDebouncedFn(callee, delayer) {
68
11
  let ctxId = 0;
@@ -80,4 +23,4 @@ function renderDOMHead(head, options) {
80
23
  return renderDOMHead$1(head, options);
81
24
  }
82
25
 
83
- export { createDebouncedFn, createDomRenderer, createHead, renderDOMHead };
26
+ export { createDebouncedFn, renderDOMHead };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
- import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry, p as HeadRenderer, d as CreateHeadOptions } from './shared/unhead.DsHmk_XC.mjs';
2
- import { at as ResolvableHead, b1 as UseSeoMetaInput, J as InferLink, U as Link, K as InferScript, aI as Script } from './shared/unhead.BJTN1X0i.mjs';
3
- import { H as HeadSafe } from './shared/unhead.CZPkBynw.mjs';
4
- export { u as useScript } from './shared/unhead.Dp1MlAYz.mjs';
1
+ import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry } from './shared/unhead.DFLvtb3Z.mjs';
2
+ import { at as ResolvableHead, b1 as UseSeoMetaInput, J as InferLink, U as Link, K as InferScript, aI as Script } from './shared/unhead.DBv5uRwR.mjs';
3
+ import { H as HeadSafe } from './shared/unhead.vAjfKrQR.mjs';
4
+ export { c as createUnhead } from './shared/unhead.BdWlwKav.mjs';
5
+ export { u as useScript } from './shared/unhead.BAm7OHQx.mjs';
5
6
  import 'hookable';
6
7
 
7
8
  declare function useHead<T extends Unhead<any>, I = ResolvableHead>(unhead: T, input?: ResolvableHead, options?: HeadEntryOptions): ActiveHeadEntry<I>;
@@ -57,6 +58,4 @@ declare function defineLink<const T extends {
57
58
  */
58
59
  declare function defineScript<const T extends object>(script: T & InferScript<T>): Script;
59
60
 
60
- declare function createUnhead<T = ResolvableHead, R = unknown>(renderer: HeadRenderer<R>, resolvedOptions?: CreateHeadOptions): Unhead<T, R>;
61
-
62
- export { createUnhead, defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
61
+ export { defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry, p as HeadRenderer, d as CreateHeadOptions } from './shared/unhead.BRWMyYIW.js';
2
- import { at as ResolvableHead, b1 as UseSeoMetaInput, J as InferLink, U as Link, K as InferScript, aI as Script } from './shared/unhead.BJTN1X0i.js';
3
- import { H as HeadSafe } from './shared/unhead.BhElfVXO.js';
4
- export { u as useScript } from './shared/unhead.DH3TZMHc.js';
1
+ import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry } from './shared/unhead.CZmLNN-R.js';
2
+ import { at as ResolvableHead, b1 as UseSeoMetaInput, J as InferLink, U as Link, K as InferScript, aI as Script } from './shared/unhead.DBv5uRwR.js';
3
+ import { H as HeadSafe } from './shared/unhead.BTcZ161H.js';
4
+ export { c as createUnhead } from './shared/unhead.BHSg79VK.js';
5
+ export { u as useScript } from './shared/unhead.DeVAJflP.js';
5
6
  import 'hookable';
6
7
 
7
8
  declare function useHead<T extends Unhead<any>, I = ResolvableHead>(unhead: T, input?: ResolvableHead, options?: HeadEntryOptions): ActiveHeadEntry<I>;
@@ -57,6 +58,4 @@ declare function defineLink<const T extends {
57
58
  */
58
59
  declare function defineScript<const T extends object>(script: T & InferScript<T>): Script;
59
60
 
60
- declare function createUnhead<T = ResolvableHead, R = unknown>(renderer: HeadRenderer<R>, resolvedOptions?: CreateHeadOptions): Unhead<T, R>;
61
-
62
- export { createUnhead, defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
61
+ export { defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
package/dist/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
- import { S as SafeInputPlugin, F as FlatMetaPlugin } from './shared/unhead.D_bywjUE.mjs';
1
+ import { S as SafeInputPlugin, F as FlatMetaPlugin } from './shared/unhead.A4ndrqqe.mjs';
2
2
  export { c as createUnhead } from './shared/unhead.CfgPMHXt.mjs';
3
3
  export { u as useScript } from './shared/unhead.DctB-0lW.mjs';
4
4
  import './shared/unhead.JWUDzlIs.mjs';
5
5
  import './shared/unhead.fg-0ge_u.mjs';
6
+ import './shared/unhead.CUXLLRtV.mjs';
6
7
  import './shared/unhead.DvIxXxuO.mjs';
7
8
  import 'hookable';
8
9
 
@@ -0,0 +1,26 @@
1
+ import { c as createUnhead } from './shared/unhead.BdWlwKav.mjs';
2
+ import { n as HeadPluginInput, U as Unhead, c as CreateClientHeadOptions, e as CreateServerHeadOptions } from './shared/unhead.DFLvtb3Z.mjs';
3
+ import { at as ResolvableHead } from './shared/unhead.DBv5uRwR.mjs';
4
+ import 'hookable';
5
+
6
+ /**
7
+ * Maps unhead v1/v2 tag props (`children`, `hid`, `vmid`, `body`, `renderPriority`) to their
8
+ * v3 equivalents (`innerHTML`, `key`, `tagPosition`, `tagPriority`).
9
+ *
10
+ * Intended as a temporary migration aid. Remove once all call sites use the v3 API.
11
+ */
12
+ declare const DeprecationsPlugin: HeadPluginInput;
13
+ /**
14
+ * The full v2 migration plugin set applied by the legacy `createHead`/`createServerHead`.
15
+ * Export so users with a custom `createHead` can opt into one-line v2 compatibility.
16
+ */
17
+ declare const legacyPlugins: HeadPluginInput[];
18
+ declare const activeHead: {
19
+ value: Unhead<any> | null;
20
+ };
21
+ declare function getActiveHead<T extends Record<string, any> = ResolvableHead>(): Unhead<T> | null;
22
+ declare function createHead<T extends Record<string, any> = ResolvableHead>(options?: CreateClientHeadOptions): Unhead<T>;
23
+ declare function createServerHead<T extends Record<string, any> = ResolvableHead>(options?: Omit<CreateServerHeadOptions, 'propResolvers'>): Unhead<T>;
24
+ declare const createHeadCore: typeof createUnhead;
25
+
26
+ export { DeprecationsPlugin, activeHead, createHead, createHeadCore, createServerHead, getActiveHead, legacyPlugins };
@@ -0,0 +1,26 @@
1
+ import { c as createUnhead } from './shared/unhead.BHSg79VK.js';
2
+ import { n as HeadPluginInput, U as Unhead, c as CreateClientHeadOptions, e as CreateServerHeadOptions } from './shared/unhead.CZmLNN-R.js';
3
+ import { at as ResolvableHead } from './shared/unhead.DBv5uRwR.js';
4
+ import 'hookable';
5
+
6
+ /**
7
+ * Maps unhead v1/v2 tag props (`children`, `hid`, `vmid`, `body`, `renderPriority`) to their
8
+ * v3 equivalents (`innerHTML`, `key`, `tagPosition`, `tagPriority`).
9
+ *
10
+ * Intended as a temporary migration aid. Remove once all call sites use the v3 API.
11
+ */
12
+ declare const DeprecationsPlugin: HeadPluginInput;
13
+ /**
14
+ * The full v2 migration plugin set applied by the legacy `createHead`/`createServerHead`.
15
+ * Export so users with a custom `createHead` can opt into one-line v2 compatibility.
16
+ */
17
+ declare const legacyPlugins: HeadPluginInput[];
18
+ declare const activeHead: {
19
+ value: Unhead<any> | null;
20
+ };
21
+ declare function getActiveHead<T extends Record<string, any> = ResolvableHead>(): Unhead<T> | null;
22
+ declare function createHead<T extends Record<string, any> = ResolvableHead>(options?: CreateClientHeadOptions): Unhead<T>;
23
+ declare function createServerHead<T extends Record<string, any> = ResolvableHead>(options?: Omit<CreateServerHeadOptions, 'propResolvers'>): Unhead<T>;
24
+ declare const createHeadCore: typeof createUnhead;
25
+
26
+ export { DeprecationsPlugin, activeHead, createHead, createHeadCore, createServerHead, getActiveHead, legacyPlugins };
@@ -0,0 +1,63 @@
1
+ import { P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin } from './shared/unhead.CH30252c.mjs';
2
+ import { d as defineHeadPlugin } from './shared/unhead.CUXLLRtV.mjs';
3
+ import { c as createUnhead } from './shared/unhead.CfgPMHXt.mjs';
4
+ import { c as createHead$1 } from './shared/unhead.YnmwhfIN.mjs';
5
+ import { c as createHead$2 } from './shared/unhead.C5ypJnIO.mjs';
6
+ import './shared/unhead.BGFxPGPQ.mjs';
7
+ import './shared/unhead.DvIxXxuO.mjs';
8
+ import 'hookable';
9
+ import './shared/unhead.pv34ME7O.mjs';
10
+ import './shared/unhead.fg-0ge_u.mjs';
11
+ import './shared/unhead.DiRbsb3I.mjs';
12
+
13
+ const DeprecationsPlugin = /* @__PURE__ */ defineHeadPlugin({
14
+ key: "deprecations",
15
+ hooks: {
16
+ "entries:normalize": ({ tags }) => {
17
+ for (const tag of tags) {
18
+ if (tag.props.children) {
19
+ tag.innerHTML = tag.props.children;
20
+ delete tag.props.children;
21
+ }
22
+ if (tag.props.hid) {
23
+ tag.key = tag.props.hid;
24
+ delete tag.props.hid;
25
+ }
26
+ if (tag.props.vmid) {
27
+ tag.key = tag.props.vmid;
28
+ delete tag.props.vmid;
29
+ }
30
+ if ("body" in tag.props) {
31
+ if (tag.props.body) {
32
+ tag.tagPosition = "bodyClose";
33
+ }
34
+ delete tag.props.body;
35
+ }
36
+ if (tag.props.renderPriority != null) {
37
+ tag.tagPriority = tag.props.renderPriority;
38
+ delete tag.props.renderPriority;
39
+ }
40
+ }
41
+ }
42
+ }
43
+ });
44
+ const legacyPlugins = [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin];
45
+ const activeHead = { value: null };
46
+ function getActiveHead() {
47
+ return activeHead.value;
48
+ }
49
+ function createHead(options = {}) {
50
+ return activeHead.value = createHead$1({
51
+ ...options,
52
+ plugins: [...legacyPlugins, ...options.plugins || []]
53
+ });
54
+ }
55
+ function createServerHead(options = {}) {
56
+ return activeHead.value = createHead$2({
57
+ ...options,
58
+ plugins: [...legacyPlugins, ...options.plugins || []]
59
+ });
60
+ }
61
+ const createHeadCore = createUnhead;
62
+
63
+ export { DeprecationsPlugin, activeHead, createHead, createHeadCore, createServerHead, getActiveHead, legacyPlugins };
package/dist/parser.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { aM as SerializableHead } from './shared/unhead.BJTN1X0i.mjs';
1
+ import { aM as SerializableHead } from './shared/unhead.DBv5uRwR.mjs';
2
2
 
3
3
  declare const TagIdMap: {
4
4
  readonly html: 0;
package/dist/parser.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { aM as SerializableHead } from './shared/unhead.BJTN1X0i.js';
1
+ import { aM as SerializableHead } from './shared/unhead.DBv5uRwR.js';
2
2
 
3
3
  declare const TagIdMap: {
4
4
  readonly html: 0;
@@ -1,5 +1,5 @@
1
- import { n as HeadPluginInput, U as Unhead, o as HeadPluginOptions } from './shared/unhead.DsHmk_XC.mjs';
2
- import { t as HeadTag } from './shared/unhead.BJTN1X0i.mjs';
1
+ import { n as HeadPluginInput, U as Unhead, o as HeadPluginOptions } from './shared/unhead.DFLvtb3Z.mjs';
2
+ import { t as HeadTag } from './shared/unhead.DBv5uRwR.mjs';
3
3
  import 'hookable';
4
4
 
5
5
  declare const AliasSortingPlugin: HeadPluginInput;
package/dist/plugins.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as HeadPluginInput, U as Unhead, o as HeadPluginOptions } from './shared/unhead.BRWMyYIW.js';
2
- import { t as HeadTag } from './shared/unhead.BJTN1X0i.js';
1
+ import { n as HeadPluginInput, U as Unhead, o as HeadPluginOptions } from './shared/unhead.CZmLNN-R.js';
2
+ import { t as HeadTag } from './shared/unhead.DBv5uRwR.js';
3
3
  import 'hookable';
4
4
 
5
5
  declare const AliasSortingPlugin: HeadPluginInput;
package/dist/plugins.mjs CHANGED
@@ -1,48 +1,11 @@
1
- import { d as defineHeadPlugin } from './shared/unhead.D_bywjUE.mjs';
2
- export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.D_bywjUE.mjs';
1
+ export { A as AliasSortingPlugin, P as PromisesPlugin, T as TemplateParamsPlugin } from './shared/unhead.CH30252c.mjs';
2
+ import { d as defineHeadPlugin } from './shared/unhead.CUXLLRtV.mjs';
3
+ export { F as FlatMetaPlugin, S as SafeInputPlugin } from './shared/unhead.A4ndrqqe.mjs';
3
4
  import { minifyJS, minifyCSS, minifyJSON } from './minify.mjs';
4
- import { p as processTemplateParams } from './shared/unhead.BGFxPGPQ.mjs';
5
+ import './shared/unhead.BGFxPGPQ.mjs';
5
6
  import './shared/unhead.JWUDzlIs.mjs';
6
7
  import './shared/unhead.fg-0ge_u.mjs';
7
8
 
8
- const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w;
9
- const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k;
10
- const AliasSortingPlugin = defineHeadPlugin({
11
- key: "aliasSorting",
12
- hooks: {
13
- "tags:resolve": (ctx) => {
14
- let m = false;
15
- for (const t of ctx.tags) {
16
- const p = t.tagPriority;
17
- if (!p)
18
- continue;
19
- const s = String(p);
20
- if (s.startsWith("before:")) {
21
- const k = formatKey(s.slice(7));
22
- const l = ctx.tagMap.get(k);
23
- if (l) {
24
- if (typeof l.tagPriority === "number")
25
- t.tagPriority = l.tagPriority;
26
- t._p = l._p - 1;
27
- m = true;
28
- }
29
- } else if (s.startsWith("after:")) {
30
- const k = formatKey(s.slice(6));
31
- const l = ctx.tagMap.get(k);
32
- if (l) {
33
- if (typeof l.tagPriority === "number")
34
- t.tagPriority = l.tagPriority;
35
- t._p = l._p + 1;
36
- m = true;
37
- }
38
- }
39
- }
40
- if (m)
41
- ctx.tags = ctx.tags.sort(sortTags);
42
- }
43
- }
44
- });
45
-
46
9
  const META_TRANSFORMABLE_URL = [
47
10
  "og:url",
48
11
  "og:image",
@@ -238,93 +201,6 @@ function MinifyPlugin(options) {
238
201
  };
239
202
  }
240
203
 
241
- async function walkPromises(v) {
242
- const type = typeof v;
243
- if (type === "function") {
244
- return v;
245
- }
246
- if (v instanceof Promise) {
247
- return await v;
248
- }
249
- if (Array.isArray(v)) {
250
- return await Promise.all(v.map((r) => walkPromises(r)));
251
- }
252
- if (v?.constructor === Object) {
253
- const next = {};
254
- for (const key of Object.keys(v)) {
255
- next[key] = await walkPromises(v[key]);
256
- }
257
- return next;
258
- }
259
- return v;
260
- }
261
- const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({
262
- key: "promises",
263
- hooks: {
264
- "entries:resolve": async (ctx) => {
265
- const promises = [];
266
- for (const k in ctx.entries) {
267
- if (!ctx.entries[k]._promisesProcessed) {
268
- promises.push(
269
- walkPromises(ctx.entries[k].input).then((val) => {
270
- ctx.entries[k].input = val;
271
- ctx.entries[k]._promisesProcessed = true;
272
- })
273
- );
274
- }
275
- }
276
- await Promise.all(promises);
277
- }
278
- }
279
- });
280
-
281
- const SupportedAttrs = {
282
- meta: "content",
283
- link: "href",
284
- htmlAttrs: "lang"
285
- };
286
- const contentAttrs = ["innerHTML", "textContent"];
287
- const TemplateParamsPlugin = /* @__PURE__ */ defineHeadPlugin((head) => {
288
- return {
289
- key: "template-params",
290
- hooks: {
291
- "tags:resolve": ({ tagMap, tags }) => {
292
- const params = tagMap.get("templateParams")?.props || {};
293
- const sep = params.separator || "|";
294
- delete params.separator;
295
- params.pageTitle = processTemplateParams(
296
- // find templateParams
297
- params.pageTitle || head._title || "",
298
- params,
299
- sep
300
- );
301
- for (const tag of tags) {
302
- if (tag.processTemplateParams === false) {
303
- continue;
304
- }
305
- const v = SupportedAttrs[tag.tag];
306
- if (v && typeof tag.props[v] === "string") {
307
- tag.props[v] = processTemplateParams(tag.props[v], params, sep);
308
- } else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") {
309
- for (const p of contentAttrs) {
310
- if (typeof tag[p] === "string")
311
- tag[p] = processTemplateParams(tag[p], params, sep, tag.tag === "script" && tag.props.type.endsWith("json"));
312
- }
313
- }
314
- }
315
- head._templateParams = params;
316
- head._separator = sep;
317
- },
318
- "tags:afterResolve": ({ tagMap }) => {
319
- const title = tagMap.get("title");
320
- if (title?.textContent && title.processTemplateParams !== false) {
321
- title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator);
322
- }
323
- }
324
- }
325
- };
326
- });
327
-
328
204
  const URL_META_KEYS = /* @__PURE__ */ new Set([
329
205
  "og:url",
330
206
  "og:image",
@@ -831,4 +707,4 @@ function ValidatePlugin(options = {}) {
831
707
  });
832
708
  }
833
709
 
834
- export { AliasSortingPlugin, CanonicalPlugin, InferSeoMetaPlugin, MinifyPlugin, PromisesPlugin, TemplateParamsPlugin, ValidatePlugin, defineHeadPlugin };
710
+ export { CanonicalPlugin, InferSeoMetaPlugin, MinifyPlugin, ValidatePlugin, defineHeadPlugin };
@@ -1,8 +1,8 @@
1
- import { R as RecordingEntry } from './shared/unhead.DsHmk_XC.mjs';
2
- export { a as AsVoidFunctions, j as EventHandlerOptions, u as ScriptInstance, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.DsHmk_XC.mjs';
3
- export { u as useScript } from './shared/unhead.Dp1MlAYz.mjs';
1
+ import { R as RecordingEntry } from './shared/unhead.DFLvtb3Z.mjs';
2
+ export { a as AsVoidFunctions, j as EventHandlerOptions, u as ScriptInstance, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.DFLvtb3Z.mjs';
3
+ export { u as useScript } from './shared/unhead.BAm7OHQx.mjs';
4
4
  import 'hookable';
5
- import './shared/unhead.BJTN1X0i.mjs';
5
+ import './shared/unhead.DBv5uRwR.mjs';
6
6
 
7
7
  declare function createSpyProxy<T extends Record<string, any> | any[]>(target: T, onApply: (stack: RecordingEntry[][]) => void): T;
8
8
 
package/dist/scripts.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { R as RecordingEntry } from './shared/unhead.BRWMyYIW.js';
2
- export { a as AsVoidFunctions, j as EventHandlerOptions, u as ScriptInstance, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.BRWMyYIW.js';
3
- export { u as useScript } from './shared/unhead.DH3TZMHc.js';
1
+ import { R as RecordingEntry } from './shared/unhead.CZmLNN-R.js';
2
+ export { a as AsVoidFunctions, j as EventHandlerOptions, u as ScriptInstance, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.CZmLNN-R.js';
3
+ export { u as useScript } from './shared/unhead.DeVAJflP.js';
4
4
  import 'hookable';
5
- import './shared/unhead.BJTN1X0i.js';
5
+ import './shared/unhead.DBv5uRwR.js';
6
6
 
7
7
  declare function createSpyProxy<T extends Record<string, any> | any[]>(target: T, onApply: (stack: RecordingEntry[][]) => void): T;
8
8
 
package/dist/server.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- export { S as ServerUnhead, c as createHead } from './shared/unhead.C6alnWbQ.mjs';
2
- import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.DsHmk_XC.mjs';
3
- export { e as CreateServerHeadOptions } from './shared/unhead.DsHmk_XC.mjs';
4
- import { t as HeadTag } from './shared/unhead.BJTN1X0i.mjs';
1
+ export { S as ServerUnhead, c as createHead } from './shared/unhead.myNKutCo.mjs';
2
+ import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.DFLvtb3Z.mjs';
3
+ export { e as CreateServerHeadOptions } from './shared/unhead.DFLvtb3Z.mjs';
4
+ import { t as HeadTag } from './shared/unhead.DBv5uRwR.mjs';
5
5
  import 'hookable';
6
6
 
7
7
  declare function createServerRenderer(options?: RenderSSRHeadOptions): HeadRenderer<SSRHeadPayload>;
package/dist/server.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { S as ServerUnhead, c as createHead } from './shared/unhead.D4KaR-FM.js';
2
- import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.BRWMyYIW.js';
3
- export { e as CreateServerHeadOptions } from './shared/unhead.BRWMyYIW.js';
4
- import { t as HeadTag } from './shared/unhead.BJTN1X0i.js';
1
+ export { S as ServerUnhead, c as createHead } from './shared/unhead.BkiQF63F.js';
2
+ import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.CZmLNN-R.js';
3
+ export { e as CreateServerHeadOptions } from './shared/unhead.CZmLNN-R.js';
4
+ import { t as HeadTag } from './shared/unhead.DBv5uRwR.js';
5
5
  import 'hookable';
6
6
 
7
7
  declare function createServerRenderer(options?: RenderSSRHeadOptions): HeadRenderer<SSRHeadPayload>;
@@ -1,8 +1,5 @@
1
1
  import { u as unpackMeta } from './unhead.JWUDzlIs.mjs';
2
-
3
- function defineHeadPlugin(plugin) {
4
- return plugin;
5
- }
2
+ import { d as defineHeadPlugin } from './unhead.CUXLLRtV.mjs';
6
3
 
7
4
  const FlatMetaPlugin = /* @__PURE__ */ defineHeadPlugin({
8
5
  key: "flatMeta",
@@ -233,4 +230,4 @@ const SafeInputPlugin = (
233
230
  })
234
231
  );
235
232
 
236
- export { FlatMetaPlugin as F, SafeInputPlugin as S, defineHeadPlugin as d };
233
+ export { FlatMetaPlugin as F, SafeInputPlugin as S };
@@ -1,4 +1,4 @@
1
- import { U as Unhead, F as UseScriptInput, G as UseScriptOptions, J as UseScriptReturn } from './unhead.DsHmk_XC.mjs';
1
+ import { U as Unhead, F as UseScriptInput, G as UseScriptOptions, J as UseScriptReturn } from './unhead.DFLvtb3Z.mjs';
2
2
 
3
3
  /**
4
4
  * Load third-party scripts with SSR support and a proxied API.
@@ -0,0 +1,6 @@
1
+ import { p as HeadRenderer, d as CreateHeadOptions, U as Unhead } from './unhead.CZmLNN-R.js';
2
+ import { at as ResolvableHead } from './unhead.DBv5uRwR.js';
3
+
4
+ declare function createUnhead<T = ResolvableHead, R = unknown>(renderer: HeadRenderer<R>, resolvedOptions?: CreateHeadOptions): Unhead<T, R>;
5
+
6
+ export { createUnhead as c };
@@ -1,4 +1,4 @@
1
- import { t as HeadTag } from './unhead.BJTN1X0i.js';
1
+ import { t as HeadTag } from './unhead.DBv5uRwR.js';
2
2
 
3
3
  interface RenderDomHeadOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { aq as RawInput, at as ResolvableHead, aF as ResolvableValue, ay as ResolvableProperties, G as GenericLink, D as DataKeys, aH as SchemaAugmentations, a3 as MetaGeneric, r as GenericScript, a_ as UnheadHtmlAttributes, aZ as UnheadBodyAttributesWithoutEvents } from './unhead.BJTN1X0i.js';
1
+ import { aq as RawInput, at as ResolvableHead, aF as ResolvableValue, ay as ResolvableProperties, G as GenericLink, D as DataKeys, aH as SchemaAugmentations, a3 as MetaGeneric, r as GenericScript, a_ as UnheadHtmlAttributes, aZ as UnheadBodyAttributesWithoutEvents } from './unhead.DBv5uRwR.js';
2
2
 
3
3
  type Base = RawInput<'base'>;
4
4
  type HtmlAttributes = RawInput<'htmlAttrs'>;
@@ -0,0 +1,6 @@
1
+ import { p as HeadRenderer, d as CreateHeadOptions, U as Unhead } from './unhead.DFLvtb3Z.mjs';
2
+ import { at as ResolvableHead } from './unhead.DBv5uRwR.mjs';
3
+
4
+ declare function createUnhead<T = ResolvableHead, R = unknown>(renderer: HeadRenderer<R>, resolvedOptions?: CreateHeadOptions): Unhead<T, R>;
5
+
6
+ export { createUnhead as c };
@@ -1,6 +1,6 @@
1
1
  import { HookableCore } from 'hookable';
2
- import { U as Unhead, s as SSRHeadPayload, v as ServerHeadHooks, e as CreateServerHeadOptions } from './unhead.BRWMyYIW.js';
3
- import { at as ResolvableHead } from './unhead.BJTN1X0i.js';
2
+ import { U as Unhead, s as SSRHeadPayload, v as ServerHeadHooks, e as CreateServerHeadOptions } from './unhead.CZmLNN-R.js';
3
+ import { at as ResolvableHead } from './unhead.DBv5uRwR.js';
4
4
 
5
5
  interface ServerUnhead<T = ResolvableHead> extends Unhead<T, SSRHeadPayload> {
6
6
  hooks: HookableCore<ServerHeadHooks>;
@@ -0,0 +1,129 @@
1
+ import { d as defineHeadPlugin } from './unhead.CUXLLRtV.mjs';
2
+ import { p as processTemplateParams } from './unhead.BGFxPGPQ.mjs';
3
+
4
+ const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w;
5
+ const formatKey = (k) => !k.includes(":key") ? k.split(":").join(":key:") : k;
6
+ const AliasSortingPlugin = defineHeadPlugin({
7
+ key: "aliasSorting",
8
+ hooks: {
9
+ "tags:resolve": (ctx) => {
10
+ let m = false;
11
+ for (const t of ctx.tags) {
12
+ const p = t.tagPriority;
13
+ if (!p)
14
+ continue;
15
+ const s = String(p);
16
+ if (s.startsWith("before:")) {
17
+ const k = formatKey(s.slice(7));
18
+ const l = ctx.tagMap.get(k);
19
+ if (l) {
20
+ if (typeof l.tagPriority === "number")
21
+ t.tagPriority = l.tagPriority;
22
+ t._p = l._p - 1;
23
+ m = true;
24
+ }
25
+ } else if (s.startsWith("after:")) {
26
+ const k = formatKey(s.slice(6));
27
+ const l = ctx.tagMap.get(k);
28
+ if (l) {
29
+ if (typeof l.tagPriority === "number")
30
+ t.tagPriority = l.tagPriority;
31
+ t._p = l._p + 1;
32
+ m = true;
33
+ }
34
+ }
35
+ }
36
+ if (m)
37
+ ctx.tags = ctx.tags.sort(sortTags);
38
+ }
39
+ }
40
+ });
41
+
42
+ async function walkPromises(v) {
43
+ const type = typeof v;
44
+ if (type === "function") {
45
+ return v;
46
+ }
47
+ if (v instanceof Promise) {
48
+ return await v;
49
+ }
50
+ if (Array.isArray(v)) {
51
+ return await Promise.all(v.map((r) => walkPromises(r)));
52
+ }
53
+ if (v?.constructor === Object) {
54
+ const next = {};
55
+ for (const key of Object.keys(v)) {
56
+ next[key] = await walkPromises(v[key]);
57
+ }
58
+ return next;
59
+ }
60
+ return v;
61
+ }
62
+ const PromisesPlugin = /* @__PURE__ */ defineHeadPlugin({
63
+ key: "promises",
64
+ hooks: {
65
+ "entries:resolve": async (ctx) => {
66
+ const promises = [];
67
+ for (const k in ctx.entries) {
68
+ if (!ctx.entries[k]._promisesProcessed) {
69
+ promises.push(
70
+ walkPromises(ctx.entries[k].input).then((val) => {
71
+ ctx.entries[k].input = val;
72
+ ctx.entries[k]._promisesProcessed = true;
73
+ })
74
+ );
75
+ }
76
+ }
77
+ await Promise.all(promises);
78
+ }
79
+ }
80
+ });
81
+
82
+ const SupportedAttrs = {
83
+ meta: "content",
84
+ link: "href",
85
+ htmlAttrs: "lang"
86
+ };
87
+ const contentAttrs = ["innerHTML", "textContent"];
88
+ const TemplateParamsPlugin = /* @__PURE__ */ defineHeadPlugin((head) => {
89
+ return {
90
+ key: "template-params",
91
+ hooks: {
92
+ "tags:resolve": ({ tagMap, tags }) => {
93
+ const params = tagMap.get("templateParams")?.props || {};
94
+ const sep = params.separator || "|";
95
+ delete params.separator;
96
+ params.pageTitle = processTemplateParams(
97
+ // find templateParams
98
+ params.pageTitle || head._title || "",
99
+ params,
100
+ sep
101
+ );
102
+ for (const tag of tags) {
103
+ if (tag.processTemplateParams === false) {
104
+ continue;
105
+ }
106
+ const v = SupportedAttrs[tag.tag];
107
+ if (v && typeof tag.props[v] === "string") {
108
+ tag.props[v] = processTemplateParams(tag.props[v], params, sep);
109
+ } else if (tag.processTemplateParams || tag.tag === "titleTemplate" || tag.tag === "title") {
110
+ for (const p of contentAttrs) {
111
+ if (typeof tag[p] === "string")
112
+ tag[p] = processTemplateParams(tag[p], params, sep, tag.tag === "script" && tag.props.type.endsWith("json"));
113
+ }
114
+ }
115
+ }
116
+ head._templateParams = params;
117
+ head._separator = sep;
118
+ },
119
+ "tags:afterResolve": ({ tagMap }) => {
120
+ const title = tagMap.get("title");
121
+ if (title?.textContent && title.processTemplateParams !== false) {
122
+ title.textContent = processTemplateParams(title.textContent, head._templateParams, head._separator);
123
+ }
124
+ }
125
+ }
126
+ };
127
+ });
128
+
129
+ export { AliasSortingPlugin as A, PromisesPlugin as P, TemplateParamsPlugin as T };
@@ -1,6 +1,6 @@
1
1
  import { HookableCore } from 'hookable';
2
- import { U as Unhead, C as ClientHeadHooks, c as CreateClientHeadOptions } from './unhead.DsHmk_XC.mjs';
3
- import { at as ResolvableHead } from './unhead.BJTN1X0i.mjs';
2
+ import { U as Unhead, C as ClientHeadHooks, c as CreateClientHeadOptions } from './unhead.DFLvtb3Z.mjs';
3
+ import { at as ResolvableHead } from './unhead.DBv5uRwR.mjs';
4
4
 
5
5
  interface ClientUnhead<T = ResolvableHead> extends Unhead<T, boolean> {
6
6
  hooks: HookableCore<ClientHeadHooks>;
@@ -0,0 +1,5 @@
1
+ function defineHeadPlugin(plugin) {
2
+ return plugin;
3
+ }
4
+
5
+ export { defineHeadPlugin as d };
@@ -1,5 +1,5 @@
1
1
  import { HookableCore } from 'hookable';
2
- import { r as GenericScript, aK as ScriptHttpEvents, D as DataKeys, _ as MaybeEventFnHandlers, x as HttpEventAttributes, aH as SchemaAugmentations, t as HeadTag, at as ResolvableHead, aT as TagPosition, aU as TagPriority, ao as ProcessesTemplateParams, aG as ResolvesDuplicates, aW as TemplateParams } from './unhead.BJTN1X0i.js';
2
+ import { r as GenericScript, aK as ScriptHttpEvents, D as DataKeys, _ as MaybeEventFnHandlers, x as HttpEventAttributes, aH as SchemaAugmentations, t as HeadTag, at as ResolvableHead, aT as TagPosition, aU as TagPriority, ao as ProcessesTemplateParams, aG as ResolvesDuplicates, aW as TemplateParams } from './unhead.DBv5uRwR.js';
3
3
 
4
4
  type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
5
5
  type UseScriptContext<T extends Record<symbol | string, any>> = ScriptInstance<T>;
@@ -2133,12 +2133,41 @@ type NoscriptContent = {
2133
2133
  type Noscript = Pick<GlobalAttributes, 'id' | 'class' | 'style'> & NoscriptContent;
2134
2134
 
2135
2135
  interface SpeculationRules {
2136
- prefetch?: readonly (SpeculationRuleList | SpeculationRuleDocument)[];
2137
- prerender?: readonly (SpeculationRuleList | SpeculationRuleDocument)[];
2136
+ prefetch?: readonly SpeculationRule[];
2137
+ prerender?: readonly SpeculationRule[];
2138
2138
  }
2139
- interface SpeculationRuleBase {
2139
+ /**
2140
+ * A single speculation rule entry.
2141
+ *
2142
+ * List rules provide explicit `urls`; document rules provide a `where` selector.
2143
+ * Both shapes share the same interface so TypeScript doesn't require exact
2144
+ * literal `source` values, which avoids widening issues inside `useHead`.
2145
+ *
2146
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md
2147
+ */
2148
+ interface SpeculationRule {
2149
+ /**
2150
+ * The rule source type.
2151
+ *
2152
+ * `'list'` for explicit URL lists, `'document'` for selector-based rules.
2153
+ *
2154
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md
2155
+ */
2156
+ source?: 'list' | 'document' | (string & Record<never, never>);
2140
2157
  /**
2141
- * A hint about how likely the user is to navigate to the URL
2158
+ * Explicit URLs to speculate on (list rules).
2159
+ *
2160
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#list-rules
2161
+ */
2162
+ urls?: readonly string[];
2163
+ /**
2164
+ * Selector conditions for document rules.
2165
+ *
2166
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#document-rules
2167
+ */
2168
+ where?: SpeculationRuleWhere;
2169
+ /**
2170
+ * A hint about how likely the user is to navigate to the URL.
2142
2171
  *
2143
2172
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#scores
2144
2173
  */
@@ -2148,36 +2177,28 @@ interface SpeculationRuleBase {
2148
2177
  *
2149
2178
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#using-the-documents-base-url-for-external-speculation-rule-sets
2150
2179
  */
2151
- relative_to?: 'document';
2180
+ relative_to?: 'document' | (string & Record<never, never>);
2152
2181
  /**
2153
- * Assertions in the rule about the capabilities of the user agent while executing them.
2182
+ * Assertions about user agent capabilities required to execute the rule.
2154
2183
  *
2155
2184
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#requirements
2156
2185
  */
2157
- requires?: readonly 'anonymous-client-ip-when-cross-origin'[];
2186
+ requires?: readonly ('anonymous-client-ip-when-cross-origin' | (string & Record<never, never>))[];
2158
2187
  /**
2159
- * Indicating where the page expects the prerendered content to be activated.
2188
+ * Where the page expects the prerendered content to be activated.
2160
2189
  *
2161
2190
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints
2162
2191
  */
2163
- target_hint?: '_blank' | '_self' | '_parent' | '_top';
2192
+ target_hint?: '_blank' | '_self' | '_parent' | '_top' | (string & Record<never, never>);
2164
2193
  /**
2165
- * The policy to use for the speculative request.
2194
+ * The referrer policy for the speculative request.
2166
2195
  *
2167
2196
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#explicit-referrer-policy
2168
2197
  */
2169
2198
  referrer_policy?: ReferrerPolicy;
2170
2199
  }
2171
- interface SpeculationRuleList extends SpeculationRuleBase {
2172
- source: 'list';
2173
- urls: readonly string[];
2174
- }
2175
2200
  type SpeculationRuleFn = 'and' | 'or' | 'href_matches' | 'selector_matches' | 'not';
2176
2201
  type SpeculationRuleWhere = Partial<Record<SpeculationRuleFn, readonly Partial<(Record<SpeculationRuleFn, (Partial<Record<SpeculationRuleFn, string>>) | string>)>[]>>;
2177
- interface SpeculationRuleDocument extends SpeculationRuleBase {
2178
- source: 'document';
2179
- where: SpeculationRuleWhere;
2180
- }
2181
2202
 
2182
2203
  /**
2183
2204
  * Events that fire on script elements (load/error)
@@ -2133,12 +2133,41 @@ type NoscriptContent = {
2133
2133
  type Noscript = Pick<GlobalAttributes, 'id' | 'class' | 'style'> & NoscriptContent;
2134
2134
 
2135
2135
  interface SpeculationRules {
2136
- prefetch?: readonly (SpeculationRuleList | SpeculationRuleDocument)[];
2137
- prerender?: readonly (SpeculationRuleList | SpeculationRuleDocument)[];
2136
+ prefetch?: readonly SpeculationRule[];
2137
+ prerender?: readonly SpeculationRule[];
2138
2138
  }
2139
- interface SpeculationRuleBase {
2139
+ /**
2140
+ * A single speculation rule entry.
2141
+ *
2142
+ * List rules provide explicit `urls`; document rules provide a `where` selector.
2143
+ * Both shapes share the same interface so TypeScript doesn't require exact
2144
+ * literal `source` values, which avoids widening issues inside `useHead`.
2145
+ *
2146
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md
2147
+ */
2148
+ interface SpeculationRule {
2149
+ /**
2150
+ * The rule source type.
2151
+ *
2152
+ * `'list'` for explicit URL lists, `'document'` for selector-based rules.
2153
+ *
2154
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md
2155
+ */
2156
+ source?: 'list' | 'document' | (string & Record<never, never>);
2140
2157
  /**
2141
- * A hint about how likely the user is to navigate to the URL
2158
+ * Explicit URLs to speculate on (list rules).
2159
+ *
2160
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#list-rules
2161
+ */
2162
+ urls?: readonly string[];
2163
+ /**
2164
+ * Selector conditions for document rules.
2165
+ *
2166
+ * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#document-rules
2167
+ */
2168
+ where?: SpeculationRuleWhere;
2169
+ /**
2170
+ * A hint about how likely the user is to navigate to the URL.
2142
2171
  *
2143
2172
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#scores
2144
2173
  */
@@ -2148,36 +2177,28 @@ interface SpeculationRuleBase {
2148
2177
  *
2149
2178
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#using-the-documents-base-url-for-external-speculation-rule-sets
2150
2179
  */
2151
- relative_to?: 'document';
2180
+ relative_to?: 'document' | (string & Record<never, never>);
2152
2181
  /**
2153
- * Assertions in the rule about the capabilities of the user agent while executing them.
2182
+ * Assertions about user agent capabilities required to execute the rule.
2154
2183
  *
2155
2184
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#requirements
2156
2185
  */
2157
- requires?: readonly 'anonymous-client-ip-when-cross-origin'[];
2186
+ requires?: readonly ('anonymous-client-ip-when-cross-origin' | (string & Record<never, never>))[];
2158
2187
  /**
2159
- * Indicating where the page expects the prerendered content to be activated.
2188
+ * Where the page expects the prerendered content to be activated.
2160
2189
  *
2161
2190
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints
2162
2191
  */
2163
- target_hint?: '_blank' | '_self' | '_parent' | '_top';
2192
+ target_hint?: '_blank' | '_self' | '_parent' | '_top' | (string & Record<never, never>);
2164
2193
  /**
2165
- * The policy to use for the speculative request.
2194
+ * The referrer policy for the speculative request.
2166
2195
  *
2167
2196
  * @see https://github.com/WICG/nav-speculation/blob/main/triggers.md#explicit-referrer-policy
2168
2197
  */
2169
2198
  referrer_policy?: ReferrerPolicy;
2170
2199
  }
2171
- interface SpeculationRuleList extends SpeculationRuleBase {
2172
- source: 'list';
2173
- urls: readonly string[];
2174
- }
2175
2200
  type SpeculationRuleFn = 'and' | 'or' | 'href_matches' | 'selector_matches' | 'not';
2176
2201
  type SpeculationRuleWhere = Partial<Record<SpeculationRuleFn, readonly Partial<(Record<SpeculationRuleFn, (Partial<Record<SpeculationRuleFn, string>>) | string>)>[]>>;
2177
- interface SpeculationRuleDocument extends SpeculationRuleBase {
2178
- source: 'document';
2179
- where: SpeculationRuleWhere;
2180
- }
2181
2202
 
2182
2203
  /**
2183
2204
  * Events that fire on script elements (load/error)
@@ -1,5 +1,5 @@
1
1
  import { HookableCore } from 'hookable';
2
- import { r as GenericScript, aK as ScriptHttpEvents, D as DataKeys, _ as MaybeEventFnHandlers, x as HttpEventAttributes, aH as SchemaAugmentations, t as HeadTag, at as ResolvableHead, aT as TagPosition, aU as TagPriority, ao as ProcessesTemplateParams, aG as ResolvesDuplicates, aW as TemplateParams } from './unhead.BJTN1X0i.mjs';
2
+ import { r as GenericScript, aK as ScriptHttpEvents, D as DataKeys, _ as MaybeEventFnHandlers, x as HttpEventAttributes, aH as SchemaAugmentations, t as HeadTag, at as ResolvableHead, aT as TagPosition, aU as TagPriority, ao as ProcessesTemplateParams, aG as ResolvesDuplicates, aW as TemplateParams } from './unhead.DBv5uRwR.mjs';
3
3
 
4
4
  type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
5
5
  type UseScriptContext<T extends Record<symbol | string, any>> = ScriptInstance<T>;
@@ -1,6 +1,6 @@
1
1
  import { HookableCore } from 'hookable';
2
- import { U as Unhead, C as ClientHeadHooks, c as CreateClientHeadOptions } from './unhead.BRWMyYIW.js';
3
- import { at as ResolvableHead } from './unhead.BJTN1X0i.js';
2
+ import { U as Unhead, C as ClientHeadHooks, c as CreateClientHeadOptions } from './unhead.CZmLNN-R.js';
3
+ import { at as ResolvableHead } from './unhead.DBv5uRwR.js';
4
4
 
5
5
  interface ClientUnhead<T = ResolvableHead> extends Unhead<T, boolean> {
6
6
  hooks: HookableCore<ClientHeadHooks>;
@@ -1,4 +1,4 @@
1
- import { t as HeadTag } from './unhead.BJTN1X0i.mjs';
1
+ import { t as HeadTag } from './unhead.DBv5uRwR.mjs';
2
2
 
3
3
  interface RenderDomHeadOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { U as Unhead, F as UseScriptInput, G as UseScriptOptions, J as UseScriptReturn } from './unhead.BRWMyYIW.js';
1
+ import { U as Unhead, F as UseScriptInput, G as UseScriptOptions, J as UseScriptReturn } from './unhead.CZmLNN-R.js';
2
2
 
3
3
  /**
4
4
  * Load third-party scripts with SSR support and a proxied API.
@@ -0,0 +1,64 @@
1
+ import { c as createUnhead, r as registerPlugin } from './unhead.CfgPMHXt.mjs';
2
+ import { c as createHooks } from './unhead.DvIxXxuO.mjs';
3
+ import { c as createDomRenderer } from './unhead.pv34ME7O.mjs';
4
+
5
+ const P = { critical: -8, high: -1, low: 2 };
6
+ const tagWeight = (tag) => typeof tag.tagPriority === "number" ? tag.tagPriority : 100 + (P[tag.tagPriority] || 0);
7
+ function createHead(options = {}) {
8
+ options.document = options.document || (typeof window !== "undefined" ? document : void 0);
9
+ const renderer = options.render || createDomRenderer({ document: options.document });
10
+ const initialPayload = options.document?.head.querySelector('script[id="unhead:payload"]')?.innerHTML || false;
11
+ const core = createUnhead(renderer, { document: options.document, propResolvers: options.propResolvers, _tagWeight: tagWeight, init: [] });
12
+ const hooks = createHooks(options.hooks);
13
+ let dirty = false;
14
+ const head = {
15
+ ...core,
16
+ ssr: false,
17
+ hooks,
18
+ use: (p) => registerPlugin(head, p),
19
+ get dirty() {
20
+ return dirty;
21
+ },
22
+ set dirty(v) {
23
+ dirty = v;
24
+ },
25
+ render: () => renderer(head),
26
+ invalidate() {
27
+ for (const e of core.entries.values()) delete e._tags;
28
+ dirty = true;
29
+ hooks.callHook("entries:updated", head);
30
+ },
31
+ push(input, _options) {
32
+ const onRendered = _options?.onRendered;
33
+ const unhook = onRendered ? hooks.hook("dom:rendered", onRendered) : void 0;
34
+ const active = core.push(input, _options);
35
+ core.entries.get(active._i)._o = input;
36
+ dirty = true;
37
+ hooks.callHook("entries:updated", head);
38
+ return {
39
+ _i: active._i,
40
+ patch(input2) {
41
+ active.patch(input2);
42
+ dirty = true;
43
+ hooks.callHook("entries:updated", head);
44
+ },
45
+ dispose() {
46
+ unhook?.();
47
+ if (core.entries.has(active._i)) {
48
+ active.dispose();
49
+ head.invalidate();
50
+ }
51
+ }
52
+ };
53
+ }
54
+ };
55
+ hooks.hook("entries:updated", () => {
56
+ renderer(head);
57
+ });
58
+ options.plugins?.forEach((p) => registerPlugin(head, p));
59
+ initialPayload && head.push(JSON.parse(initialPayload));
60
+ options.init?.forEach((e) => e && head.push(e));
61
+ return head;
62
+ }
63
+
64
+ export { createHead as c };
@@ -1,6 +1,6 @@
1
1
  import { HookableCore } from 'hookable';
2
- import { U as Unhead, s as SSRHeadPayload, v as ServerHeadHooks, e as CreateServerHeadOptions } from './unhead.DsHmk_XC.mjs';
3
- import { at as ResolvableHead } from './unhead.BJTN1X0i.mjs';
2
+ import { U as Unhead, s as SSRHeadPayload, v as ServerHeadHooks, e as CreateServerHeadOptions } from './unhead.DFLvtb3Z.mjs';
3
+ import { at as ResolvableHead } from './unhead.DBv5uRwR.mjs';
4
4
 
5
5
  interface ServerUnhead<T = ResolvableHead> extends Unhead<T, SSRHeadPayload> {
6
6
  hooks: HookableCore<ServerHeadHooks>;
@@ -1,4 +1,4 @@
1
- import { aq as RawInput, at as ResolvableHead, aF as ResolvableValue, ay as ResolvableProperties, G as GenericLink, D as DataKeys, aH as SchemaAugmentations, a3 as MetaGeneric, r as GenericScript, a_ as UnheadHtmlAttributes, aZ as UnheadBodyAttributesWithoutEvents } from './unhead.BJTN1X0i.mjs';
1
+ import { aq as RawInput, at as ResolvableHead, aF as ResolvableValue, ay as ResolvableProperties, G as GenericLink, D as DataKeys, aH as SchemaAugmentations, a3 as MetaGeneric, r as GenericScript, a_ as UnheadHtmlAttributes, aZ as UnheadBodyAttributesWithoutEvents } from './unhead.DBv5uRwR.mjs';
2
2
 
3
3
  type Base = RawInput<'base'>;
4
4
  type HtmlAttributes = RawInput<'htmlAttrs'>;
@@ -1,6 +1,6 @@
1
- import { C as ClientUnhead } from '../shared/unhead.DJ6joC2O.mjs';
2
- import { c as CreateClientHeadOptions, U as Unhead } from '../shared/unhead.DsHmk_XC.mjs';
3
- import { aM as SerializableHead, at as ResolvableHead } from '../shared/unhead.BJTN1X0i.mjs';
1
+ import { C as ClientUnhead } from '../shared/unhead.CSqfLsrn.mjs';
2
+ import { c as CreateClientHeadOptions, U as Unhead } from '../shared/unhead.DFLvtb3Z.mjs';
3
+ import { aM as SerializableHead, at as ResolvableHead } from '../shared/unhead.DBv5uRwR.mjs';
4
4
  import 'hookable';
5
5
 
6
6
  interface UnheadStreamQueue {
@@ -1,6 +1,6 @@
1
- import { C as ClientUnhead } from '../shared/unhead.CpT6Kxc0.js';
2
- import { c as CreateClientHeadOptions, U as Unhead } from '../shared/unhead.BRWMyYIW.js';
3
- import { aM as SerializableHead, at as ResolvableHead } from '../shared/unhead.BJTN1X0i.js';
1
+ import { C as ClientUnhead } from '../shared/unhead.DMQDfSsC.js';
2
+ import { c as CreateClientHeadOptions, U as Unhead } from '../shared/unhead.CZmLNN-R.js';
3
+ import { aM as SerializableHead, at as ResolvableHead } from '../shared/unhead.DBv5uRwR.js';
4
4
  import 'hookable';
5
5
 
6
6
  interface UnheadStreamQueue {
@@ -1,6 +1,6 @@
1
- import { S as ServerUnhead } from '../shared/unhead.C6alnWbQ.mjs';
2
- import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.DsHmk_XC.mjs';
3
- import { at as ResolvableHead } from '../shared/unhead.BJTN1X0i.mjs';
1
+ import { S as ServerUnhead } from '../shared/unhead.myNKutCo.mjs';
2
+ import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.DFLvtb3Z.mjs';
3
+ import { at as ResolvableHead } from '../shared/unhead.DBv5uRwR.mjs';
4
4
  import 'hookable';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { S as ServerUnhead } from '../shared/unhead.D4KaR-FM.js';
2
- import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.BRWMyYIW.js';
3
- import { at as ResolvableHead } from '../shared/unhead.BJTN1X0i.js';
1
+ import { S as ServerUnhead } from '../shared/unhead.BkiQF63F.js';
2
+ import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.CZmLNN-R.js';
3
+ import { at as ResolvableHead } from '../shared/unhead.DBv5uRwR.js';
4
4
  import 'hookable';
5
5
 
6
6
  /**
package/dist/types.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.DsHmk_XC.mjs';
2
- export { R as RenderDomHeadOptions } from './shared/unhead.BXRLaj2l.mjs';
3
- export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.CZPkBynw.mjs';
4
- import { B as Booleanable } from './shared/unhead.BJTN1X0i.mjs';
5
- export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AlternateStylesheetLink, e as AppleTouchIconLink, f as ApplicationJsonScript, g as Arrayable, h as AuthorLink, i as BareAlternateLink, j as BodyAttributesWithoutEvents, k as BodyEvents, C as CanonicalLink, l as CharsetMeta, m as CompressionDictionaryLink, D as DataKeys, n as DeepReadonly, o as DeepResolvableProperties, p as DnsPrefetchLink, E as ExpectLink, q as ExternalScript, F as FaviconLink, G as GenericLink, r as GenericScript, s as GlobalAttributes, H as HasTemplateParams, t as HeadTag, u as HeadTagKeys, v as HelpLink, w as HttpEquivMeta, x as HttpEventAttributes, I as IconLink, y as ImportMapConfig, z as ImportMapScript, J as InferLink, K as InferScript, L as InlineModuleScript, M as InlineScript, N as InnerContent, O as InnerContentVal, P as InternalTagKey, Q as JsonLdScript, R as KnownLinkRel, S as KnownScriptType, T as LicenseLink, U as Link, V as LinkBase, W as LinkHttpEvents, X as ManifestLink, Y as MaskIconLink, Z as MaybeArray, _ as MaybeEventFnHandlers, $ as MeLink, a0 as Meta, a1 as MetaBase, a2 as MetaFlat, a3 as MetaGeneric, a4 as MetaNames, a5 as MetaProperties, a6 as ModuleScript, a7 as ModulepreloadLink, a8 as NameMeta, a9 as Never, aa as NextLink, ab as PingbackLink, ac as PreconnectLink, ad as PrefetchLink, ae as PreloadFontLink, af as PreloadImageLink, ag as PreloadLink, ah as PreloadLinkBase, ai as PreloadOtherLink, aj as PreloadScriptLink, ak as PreloadStyleLink, al as PrerenderLink, am as PrevLink, an as PrivacyPolicyLink, ao as ProcessesTemplateParams, ap as PropertyMeta, aq as RawInput, ar as ResolvableBase, as as ResolvableBodyAttributes, at as ResolvableHead, au as ResolvableHtmlAttributes, av as ResolvableLink, aw as ResolvableMeta, ax as ResolvableNoscript, ay as ResolvableProperties, az as ResolvableScript, aA as ResolvableStyle, aB as ResolvableTemplateParams, aC as ResolvableTitle, aD as ResolvableTitleTemplate, aE as ResolvableUnion, aF as ResolvableValue, aG as ResolvesDuplicates, aH as SchemaAugmentations, aI as Script, aJ as ScriptBase, aK as ScriptHttpEvents, aL as SearchLink, aM as SerializableHead, aN as SpeculationRules, aO as SpeculationRulesScript, aP as StringInnerContent, aQ as Stringable, aR as StylesheetLink, aS as TagKey, aT as TagPosition, aU as TagPriority, aV as TagUserProperties, aW as TemplateParams, aX as TemplateParamsAugmentations, aY as TermsOfServiceLink, aZ as UnheadBodyAttributesWithoutEvents, a_ as UnheadHtmlAttributes, a$ as UnheadMeta, b0 as UseHeadInput, b1 as UseSeoMetaInput, b2 as ValidTagPositions, b3 as WebmentionLink } from './shared/unhead.BJTN1X0i.mjs';
1
+ export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.DFLvtb3Z.mjs';
2
+ export { R as RenderDomHeadOptions } from './shared/unhead.DR0woClT.mjs';
3
+ export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.vAjfKrQR.mjs';
4
+ import { B as Booleanable } from './shared/unhead.DBv5uRwR.mjs';
5
+ export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AlternateStylesheetLink, e as AppleTouchIconLink, f as ApplicationJsonScript, g as Arrayable, h as AuthorLink, i as BareAlternateLink, j as BodyAttributesWithoutEvents, k as BodyEvents, C as CanonicalLink, l as CharsetMeta, m as CompressionDictionaryLink, D as DataKeys, n as DeepReadonly, o as DeepResolvableProperties, p as DnsPrefetchLink, E as ExpectLink, q as ExternalScript, F as FaviconLink, G as GenericLink, r as GenericScript, s as GlobalAttributes, H as HasTemplateParams, t as HeadTag, u as HeadTagKeys, v as HelpLink, w as HttpEquivMeta, x as HttpEventAttributes, I as IconLink, y as ImportMapConfig, z as ImportMapScript, J as InferLink, K as InferScript, L as InlineModuleScript, M as InlineScript, N as InnerContent, O as InnerContentVal, P as InternalTagKey, Q as JsonLdScript, R as KnownLinkRel, S as KnownScriptType, T as LicenseLink, U as Link, V as LinkBase, W as LinkHttpEvents, X as ManifestLink, Y as MaskIconLink, Z as MaybeArray, _ as MaybeEventFnHandlers, $ as MeLink, a0 as Meta, a1 as MetaBase, a2 as MetaFlat, a3 as MetaGeneric, a4 as MetaNames, a5 as MetaProperties, a6 as ModuleScript, a7 as ModulepreloadLink, a8 as NameMeta, a9 as Never, aa as NextLink, ab as PingbackLink, ac as PreconnectLink, ad as PrefetchLink, ae as PreloadFontLink, af as PreloadImageLink, ag as PreloadLink, ah as PreloadLinkBase, ai as PreloadOtherLink, aj as PreloadScriptLink, ak as PreloadStyleLink, al as PrerenderLink, am as PrevLink, an as PrivacyPolicyLink, ao as ProcessesTemplateParams, ap as PropertyMeta, aq as RawInput, ar as ResolvableBase, as as ResolvableBodyAttributes, at as ResolvableHead, au as ResolvableHtmlAttributes, av as ResolvableLink, aw as ResolvableMeta, ax as ResolvableNoscript, ay as ResolvableProperties, az as ResolvableScript, aA as ResolvableStyle, aB as ResolvableTemplateParams, aC as ResolvableTitle, aD as ResolvableTitleTemplate, aE as ResolvableUnion, aF as ResolvableValue, aG as ResolvesDuplicates, aH as SchemaAugmentations, aI as Script, aJ as ScriptBase, aK as ScriptHttpEvents, aL as SearchLink, aM as SerializableHead, aN as SpeculationRules, aO as SpeculationRulesScript, aP as StringInnerContent, aQ as Stringable, aR as StylesheetLink, aS as TagKey, aT as TagPosition, aU as TagPriority, aV as TagUserProperties, aW as TemplateParams, aX as TemplateParamsAugmentations, aY as TermsOfServiceLink, aZ as UnheadBodyAttributesWithoutEvents, a_ as UnheadHtmlAttributes, a$ as UnheadMeta, b0 as UseHeadInput, b1 as UseSeoMetaInput, b2 as ValidTagPositions, b3 as WebmentionLink } from './shared/unhead.DBv5uRwR.mjs';
6
6
  export { createSpyProxy } from './scripts.mjs';
7
- export { u as useScript } from './shared/unhead.Dp1MlAYz.mjs';
7
+ export { u as useScript } from './shared/unhead.BAm7OHQx.mjs';
8
8
  import 'hookable';
9
9
 
10
10
  interface AriaAttributes {
package/dist/types.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.BRWMyYIW.js';
2
- export { R as RenderDomHeadOptions } from './shared/unhead.YGcEMcjf.js';
3
- export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.BhElfVXO.js';
4
- import { B as Booleanable } from './shared/unhead.BJTN1X0i.js';
5
- export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AlternateStylesheetLink, e as AppleTouchIconLink, f as ApplicationJsonScript, g as Arrayable, h as AuthorLink, i as BareAlternateLink, j as BodyAttributesWithoutEvents, k as BodyEvents, C as CanonicalLink, l as CharsetMeta, m as CompressionDictionaryLink, D as DataKeys, n as DeepReadonly, o as DeepResolvableProperties, p as DnsPrefetchLink, E as ExpectLink, q as ExternalScript, F as FaviconLink, G as GenericLink, r as GenericScript, s as GlobalAttributes, H as HasTemplateParams, t as HeadTag, u as HeadTagKeys, v as HelpLink, w as HttpEquivMeta, x as HttpEventAttributes, I as IconLink, y as ImportMapConfig, z as ImportMapScript, J as InferLink, K as InferScript, L as InlineModuleScript, M as InlineScript, N as InnerContent, O as InnerContentVal, P as InternalTagKey, Q as JsonLdScript, R as KnownLinkRel, S as KnownScriptType, T as LicenseLink, U as Link, V as LinkBase, W as LinkHttpEvents, X as ManifestLink, Y as MaskIconLink, Z as MaybeArray, _ as MaybeEventFnHandlers, $ as MeLink, a0 as Meta, a1 as MetaBase, a2 as MetaFlat, a3 as MetaGeneric, a4 as MetaNames, a5 as MetaProperties, a6 as ModuleScript, a7 as ModulepreloadLink, a8 as NameMeta, a9 as Never, aa as NextLink, ab as PingbackLink, ac as PreconnectLink, ad as PrefetchLink, ae as PreloadFontLink, af as PreloadImageLink, ag as PreloadLink, ah as PreloadLinkBase, ai as PreloadOtherLink, aj as PreloadScriptLink, ak as PreloadStyleLink, al as PrerenderLink, am as PrevLink, an as PrivacyPolicyLink, ao as ProcessesTemplateParams, ap as PropertyMeta, aq as RawInput, ar as ResolvableBase, as as ResolvableBodyAttributes, at as ResolvableHead, au as ResolvableHtmlAttributes, av as ResolvableLink, aw as ResolvableMeta, ax as ResolvableNoscript, ay as ResolvableProperties, az as ResolvableScript, aA as ResolvableStyle, aB as ResolvableTemplateParams, aC as ResolvableTitle, aD as ResolvableTitleTemplate, aE as ResolvableUnion, aF as ResolvableValue, aG as ResolvesDuplicates, aH as SchemaAugmentations, aI as Script, aJ as ScriptBase, aK as ScriptHttpEvents, aL as SearchLink, aM as SerializableHead, aN as SpeculationRules, aO as SpeculationRulesScript, aP as StringInnerContent, aQ as Stringable, aR as StylesheetLink, aS as TagKey, aT as TagPosition, aU as TagPriority, aV as TagUserProperties, aW as TemplateParams, aX as TemplateParamsAugmentations, aY as TermsOfServiceLink, aZ as UnheadBodyAttributesWithoutEvents, a_ as UnheadHtmlAttributes, a$ as UnheadMeta, b0 as UseHeadInput, b1 as UseSeoMetaInput, b2 as ValidTagPositions, b3 as WebmentionLink } from './shared/unhead.BJTN1X0i.js';
1
+ export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.CZmLNN-R.js';
2
+ export { R as RenderDomHeadOptions } from './shared/unhead.BPps6U7z.js';
3
+ export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.BTcZ161H.js';
4
+ import { B as Booleanable } from './shared/unhead.DBv5uRwR.js';
5
+ export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AlternateStylesheetLink, e as AppleTouchIconLink, f as ApplicationJsonScript, g as Arrayable, h as AuthorLink, i as BareAlternateLink, j as BodyAttributesWithoutEvents, k as BodyEvents, C as CanonicalLink, l as CharsetMeta, m as CompressionDictionaryLink, D as DataKeys, n as DeepReadonly, o as DeepResolvableProperties, p as DnsPrefetchLink, E as ExpectLink, q as ExternalScript, F as FaviconLink, G as GenericLink, r as GenericScript, s as GlobalAttributes, H as HasTemplateParams, t as HeadTag, u as HeadTagKeys, v as HelpLink, w as HttpEquivMeta, x as HttpEventAttributes, I as IconLink, y as ImportMapConfig, z as ImportMapScript, J as InferLink, K as InferScript, L as InlineModuleScript, M as InlineScript, N as InnerContent, O as InnerContentVal, P as InternalTagKey, Q as JsonLdScript, R as KnownLinkRel, S as KnownScriptType, T as LicenseLink, U as Link, V as LinkBase, W as LinkHttpEvents, X as ManifestLink, Y as MaskIconLink, Z as MaybeArray, _ as MaybeEventFnHandlers, $ as MeLink, a0 as Meta, a1 as MetaBase, a2 as MetaFlat, a3 as MetaGeneric, a4 as MetaNames, a5 as MetaProperties, a6 as ModuleScript, a7 as ModulepreloadLink, a8 as NameMeta, a9 as Never, aa as NextLink, ab as PingbackLink, ac as PreconnectLink, ad as PrefetchLink, ae as PreloadFontLink, af as PreloadImageLink, ag as PreloadLink, ah as PreloadLinkBase, ai as PreloadOtherLink, aj as PreloadScriptLink, ak as PreloadStyleLink, al as PrerenderLink, am as PrevLink, an as PrivacyPolicyLink, ao as ProcessesTemplateParams, ap as PropertyMeta, aq as RawInput, ar as ResolvableBase, as as ResolvableBodyAttributes, at as ResolvableHead, au as ResolvableHtmlAttributes, av as ResolvableLink, aw as ResolvableMeta, ax as ResolvableNoscript, ay as ResolvableProperties, az as ResolvableScript, aA as ResolvableStyle, aB as ResolvableTemplateParams, aC as ResolvableTitle, aD as ResolvableTitleTemplate, aE as ResolvableUnion, aF as ResolvableValue, aG as ResolvesDuplicates, aH as SchemaAugmentations, aI as Script, aJ as ScriptBase, aK as ScriptHttpEvents, aL as SearchLink, aM as SerializableHead, aN as SpeculationRules, aO as SpeculationRulesScript, aP as StringInnerContent, aQ as Stringable, aR as StylesheetLink, aS as TagKey, aT as TagPosition, aU as TagPriority, aV as TagUserProperties, aW as TemplateParams, aX as TemplateParamsAugmentations, aY as TermsOfServiceLink, aZ as UnheadBodyAttributesWithoutEvents, a_ as UnheadHtmlAttributes, a$ as UnheadMeta, b0 as UseHeadInput, b1 as UseSeoMetaInput, b2 as ValidTagPositions, b3 as WebmentionLink } from './shared/unhead.DBv5uRwR.js';
6
6
  export { createSpyProxy } from './scripts.js';
7
- export { u as useScript } from './shared/unhead.DH3TZMHc.js';
7
+ export { u as useScript } from './shared/unhead.DeVAJflP.js';
8
8
  import 'hookable';
9
9
 
10
10
  interface AriaAttributes {
package/dist/utils.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as HeadTag, a2 as MetaFlat, at as ResolvableHead, aW as TemplateParams } from './shared/unhead.BJTN1X0i.mjs';
2
- import { P as PropResolver, U as Unhead } from './shared/unhead.DsHmk_XC.mjs';
1
+ import { t as HeadTag, a2 as MetaFlat, at as ResolvableHead, aW as TemplateParams } from './shared/unhead.DBv5uRwR.mjs';
2
+ import { P as PropResolver, U as Unhead } from './shared/unhead.DFLvtb3Z.mjs';
3
3
  import 'hookable';
4
4
 
5
5
  declare const SelfClosingTags: Set<string>;
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as HeadTag, a2 as MetaFlat, at as ResolvableHead, aW as TemplateParams } from './shared/unhead.BJTN1X0i.js';
2
- import { P as PropResolver, U as Unhead } from './shared/unhead.BRWMyYIW.js';
1
+ import { t as HeadTag, a2 as MetaFlat, at as ResolvableHead, aW as TemplateParams } from './shared/unhead.DBv5uRwR.js';
2
+ import { P as PropResolver, U as Unhead } from './shared/unhead.CZmLNN-R.js';
3
3
  import 'hookable';
4
4
 
5
5
  declare const SelfClosingTags: Set<string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "description": "Full-stack <head> manager built for any framework.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -33,6 +33,10 @@
33
33
  "types": "./dist/plugins.d.ts",
34
34
  "default": "./dist/plugins.mjs"
35
35
  },
36
+ "./legacy": {
37
+ "types": "./dist/legacy.d.ts",
38
+ "default": "./dist/legacy.mjs"
39
+ },
36
40
  "./minify": {
37
41
  "types": "./dist/minify.d.ts",
38
42
  "default": "./dist/minify.mjs"
@@ -86,6 +90,9 @@
86
90
  "plugins": [
87
91
  "dist/plugins.d.ts"
88
92
  ],
93
+ "legacy": [
94
+ "dist/legacy.d.ts"
95
+ ],
89
96
  "minify": [
90
97
  "dist/minify.d.ts"
91
98
  ],