unhead 3.0.1 → 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.
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +6 -63
- package/dist/index.d.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +2 -1
- package/dist/legacy.d.mts +26 -0
- package/dist/legacy.d.ts +26 -0
- package/dist/legacy.mjs +63 -0
- package/dist/parser.d.mts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/plugins.d.mts +2 -2
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.mjs +5 -129
- package/dist/scripts.d.mts +4 -4
- package/dist/scripts.d.ts +4 -4
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/shared/{unhead.D_bywjUE.mjs → unhead.A4ndrqqe.mjs} +2 -5
- package/dist/shared/{unhead.dhQT0IKI.d.mts → unhead.BAm7OHQx.d.mts} +1 -1
- package/dist/shared/unhead.BHSg79VK.d.ts +6 -0
- package/dist/shared/{unhead.JGBJYEOZ.d.ts → unhead.BPps6U7z.d.ts} +1 -1
- package/dist/shared/{unhead.UFdAtJOd.d.ts → unhead.BTcZ161H.d.ts} +1 -1
- package/dist/shared/unhead.BdWlwKav.d.mts +6 -0
- package/dist/shared/{unhead.BRPfhzdc.d.ts → unhead.BkiQF63F.d.ts} +2 -2
- package/dist/shared/unhead.CH30252c.mjs +129 -0
- package/dist/shared/{unhead.BxsOjg-Q.d.mts → unhead.CSqfLsrn.d.mts} +2 -2
- package/dist/shared/unhead.CUXLLRtV.mjs +5 -0
- package/dist/shared/{unhead.BEof8Qjb.d.ts → unhead.CZmLNN-R.d.ts} +1 -1
- package/dist/shared/{unhead.5pUZeb0i.d.mts → unhead.DBv5uRwR.d.mts} +56 -27
- package/dist/shared/{unhead.5pUZeb0i.d.ts → unhead.DBv5uRwR.d.ts} +56 -27
- package/dist/shared/{unhead.CyKsApKH.d.mts → unhead.DFLvtb3Z.d.mts} +1 -1
- package/dist/shared/{unhead.D_sLwV5L.d.ts → unhead.DMQDfSsC.d.ts} +2 -2
- package/dist/shared/{unhead.BAv4ddL5.d.mts → unhead.DR0woClT.d.mts} +1 -1
- package/dist/shared/{unhead.vQPF0cJs.d.ts → unhead.DeVAJflP.d.ts} +1 -1
- package/dist/shared/unhead.YnmwhfIN.mjs +64 -0
- package/dist/shared/{unhead.DvMT2vYs.d.mts → unhead.myNKutCo.d.mts} +2 -2
- package/dist/shared/{unhead.CUEmFl2d.d.mts → unhead.vAjfKrQR.d.mts} +1 -1
- package/dist/stream/client.d.mts +3 -3
- package/dist/stream/client.d.ts +3 -3
- package/dist/stream/server.d.mts +3 -3
- package/dist/stream/server.d.ts +3 -3
- package/dist/types.d.mts +6 -6
- package/dist/types.d.ts +6 -6
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.ts +2 -2
- 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.
|
|
2
|
-
import { R as RenderDomHeadOptions } from './shared/unhead.
|
|
3
|
-
import { p as HeadRenderer, U as Unhead } from './shared/unhead.
|
|
4
|
-
export { c as CreateClientHeadOptions } from './shared/unhead.
|
|
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.
|
|
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.
|
|
2
|
-
import { R as RenderDomHeadOptions } from './shared/unhead.
|
|
3
|
-
import { p as HeadRenderer, U as Unhead } from './shared/unhead.
|
|
4
|
-
export { c as CreateClientHeadOptions } from './shared/unhead.
|
|
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.
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
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,
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import { H as HeadSafe } from './shared/unhead.
|
|
4
|
-
export {
|
|
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
|
-
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import { H as HeadSafe } from './shared/unhead.
|
|
4
|
-
export {
|
|
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
|
-
|
|
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.
|
|
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 };
|
package/dist/legacy.d.ts
ADDED
|
@@ -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 };
|
package/dist/legacy.mjs
ADDED
|
@@ -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
package/dist/parser.d.ts
CHANGED
package/dist/plugins.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as HeadPluginInput, U as Unhead, o as HeadPluginOptions } from './shared/unhead.
|
|
2
|
-
import {
|
|
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.
|
|
2
|
-
import {
|
|
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
|
-
|
|
2
|
-
|
|
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
|
|
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 {
|
|
710
|
+
export { CanonicalPlugin, InferSeoMetaPlugin, MinifyPlugin, ValidatePlugin, defineHeadPlugin };
|
package/dist/scripts.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as RecordingEntry } from './shared/unhead.
|
|
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.
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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.
|
|
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.
|
|
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.
|
|
3
|
-
export { u as useScript } from './shared/unhead.
|
|
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.
|
|
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.
|
|
2
|
-
import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.
|
|
3
|
-
export { e as CreateServerHeadOptions } from './shared/unhead.
|
|
4
|
-
import {
|
|
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.
|
|
2
|
-
import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.
|
|
3
|
-
export { e as CreateServerHeadOptions } from './shared/unhead.
|
|
4
|
-
import {
|
|
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
|
|
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.
|
|
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 {
|
|
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.
|
|
3
|
-
import {
|
|
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>;
|