unhead 3.0.0 → 3.0.1
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 +2 -2
- package/dist/index.d.mts +54 -5
- package/dist/index.d.ts +54 -5
- package/dist/index.mjs +8 -1
- 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/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/server.mjs +3 -3
- package/dist/shared/{unhead.Dyr7L2Ht.d.mts → unhead.5pUZeb0i.d.mts} +154 -26
- package/dist/shared/{unhead.Dyr7L2Ht.d.ts → unhead.5pUZeb0i.d.ts} +154 -26
- package/dist/shared/{unhead.DbDvRsnF.d.mts → unhead.BAv4ddL5.d.mts} +1 -1
- package/dist/shared/{unhead.DmIUoNyg.d.ts → unhead.BEof8Qjb.d.ts} +1 -1
- package/dist/shared/{unhead.cnX_MFeG.d.ts → unhead.BRPfhzdc.d.ts} +2 -2
- package/dist/shared/{unhead.Db0zAB-x.d.mts → unhead.BxsOjg-Q.d.mts} +2 -2
- package/dist/shared/{unhead.Sr8_Iw6G.mjs → unhead.C5ypJnIO.mjs} +8 -4
- package/dist/shared/{unhead.BiaRAmcT.d.mts → unhead.CUEmFl2d.d.mts} +1 -1
- package/dist/shared/{unhead.D6A03PN3.d.mts → unhead.CyKsApKH.d.mts} +1 -1
- package/dist/shared/{unhead.DFKqTFly.d.ts → unhead.D_sLwV5L.d.ts} +2 -2
- package/dist/shared/{unhead.DQiBmCqH.mjs → unhead.DiRbsb3I.mjs} +9 -3
- package/dist/shared/{unhead.B825tVHL.d.mts → unhead.DvMT2vYs.d.mts} +2 -2
- package/dist/shared/{unhead.DvZZ4Zb_.d.ts → unhead.JGBJYEOZ.d.ts} +1 -1
- package/dist/shared/{unhead.DKz0V2If.d.ts → unhead.UFdAtJOd.d.ts} +1 -1
- package/dist/shared/{unhead.DyN7hSCT.d.mts → unhead.dhQT0IKI.d.mts} +1 -1
- package/dist/shared/{unhead.D4TxP3zZ.mjs → unhead.pv34ME7O.mjs} +1 -1
- package/dist/shared/{unhead.Cp3HtzBy.d.ts → unhead.vQPF0cJs.d.ts} +1 -1
- package/dist/stream/client.d.mts +3 -3
- package/dist/stream/client.d.ts +3 -3
- package/dist/stream/iife.global.js +1 -1
- package/dist/stream/iife.mjs +2 -2
- package/dist/stream/server.d.mts +3 -3
- package/dist/stream/server.d.ts +3 -3
- package/dist/stream/server.mjs +16 -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/dist/utils.mjs +1 -1
- package/package.json +1 -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.BxsOjg-Q.mjs';
|
|
2
|
+
import { R as RenderDomHeadOptions } from './shared/unhead.BAv4ddL5.mjs';
|
|
3
|
+
import { p as HeadRenderer, U as Unhead } from './shared/unhead.CyKsApKH.mjs';
|
|
4
|
+
export { c as CreateClientHeadOptions } from './shared/unhead.CyKsApKH.mjs';
|
|
5
5
|
import 'hookable';
|
|
6
|
-
import './shared/unhead.
|
|
6
|
+
import './shared/unhead.5pUZeb0i.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.D_sLwV5L.js';
|
|
2
|
+
import { R as RenderDomHeadOptions } from './shared/unhead.JGBJYEOZ.js';
|
|
3
|
+
import { p as HeadRenderer, U as Unhead } from './shared/unhead.BEof8Qjb.js';
|
|
4
|
+
export { c as CreateClientHeadOptions } from './shared/unhead.BEof8Qjb.js';
|
|
5
5
|
import 'hookable';
|
|
6
|
-
import './shared/unhead.
|
|
6
|
+
import './shared/unhead.5pUZeb0i.js';
|
|
7
7
|
|
|
8
8
|
declare function createDomRenderer(options?: RenderDomHeadOptions): HeadRenderer<boolean>;
|
|
9
9
|
|
package/dist/client.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as createDomRenderer, r as renderDOMHead$1 } from './shared/unhead.
|
|
1
|
+
import { c as createDomRenderer, r as renderDOMHead$1 } from './shared/unhead.pv34ME7O.mjs';
|
|
2
2
|
import { c as createUnhead, r as registerPlugin } from './shared/unhead.CfgPMHXt.mjs';
|
|
3
3
|
import { c as createHooks } from './shared/unhead.DvIxXxuO.mjs';
|
|
4
4
|
import './shared/unhead.fg-0ge_u.mjs';
|
|
5
|
-
import './shared/unhead.
|
|
5
|
+
import './shared/unhead.DiRbsb3I.mjs';
|
|
6
6
|
import 'hookable';
|
|
7
7
|
|
|
8
8
|
const P = { critical: -8, high: -1, low: 2 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry, p as HeadRenderer, d as CreateHeadOptions } from './shared/unhead.
|
|
2
|
-
import {
|
|
3
|
-
import { H as HeadSafe } from './shared/unhead.
|
|
4
|
-
export { u as useScript } from './shared/unhead.
|
|
1
|
+
import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry, p as HeadRenderer, d as CreateHeadOptions } from './shared/unhead.CyKsApKH.mjs';
|
|
2
|
+
import { as as ResolvableHead, b0 as UseSeoMetaInput, z as InferLink, T as Link, J as InferScript, aH as Script } from './shared/unhead.5pUZeb0i.mjs';
|
|
3
|
+
import { H as HeadSafe } from './shared/unhead.CUEmFl2d.mjs';
|
|
4
|
+
export { u as useScript } from './shared/unhead.dhQT0IKI.mjs';
|
|
5
5
|
import 'hookable';
|
|
6
6
|
|
|
7
7
|
declare function useHead<T extends Unhead<any>, I = ResolvableHead>(unhead: T, input?: ResolvableHead, options?: HeadEntryOptions): ActiveHeadEntry<I>;
|
|
8
8
|
declare function useHeadSafe<T extends Unhead<any>>(unhead: T, input?: HeadSafe, options?: HeadEntryOptions): ActiveHeadEntry<HeadSafe>;
|
|
9
9
|
declare function useSeoMeta<T extends Unhead<any>>(unhead: T, input?: UseSeoMetaInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Typed helper for declaring a `<link>` element inside {@link useHead}.
|
|
13
|
+
*
|
|
14
|
+
* Known `rel` values stay strict: `rel: 'preload'` still requires `as`,
|
|
15
|
+
* preload fonts still require `crossorigin`, `rel: 'mask-icon'` still requires
|
|
16
|
+
* `color`, etc. Non-standard `rel` values not covered by `KnownLinkRel` (e.g.
|
|
17
|
+
* OpenID endpoints, custom protocol discovery links) are accepted via
|
|
18
|
+
* `GenericLink` without losing strictness on the rest of the union.
|
|
19
|
+
*
|
|
20
|
+
* Standard rels like `'me'`, `'webmention'`, `'privacy-policy'`, and
|
|
21
|
+
* `'terms-of-service'` are already in the `Link` union, so they work with
|
|
22
|
+
* `useHead` directly without this helper.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { defineLink, useHead } from 'unhead'
|
|
27
|
+
*
|
|
28
|
+
* useHead({
|
|
29
|
+
* link: [
|
|
30
|
+
* defineLink({ rel: 'openid2.provider', href: 'https://example.com/openid' }),
|
|
31
|
+
* defineLink({ rel: 'EditURI', href: '/rsd.xml', type: 'application/rsd+xml' }),
|
|
32
|
+
* ],
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function defineLink<const T extends {
|
|
37
|
+
rel: string;
|
|
38
|
+
}>(link: T & InferLink<T>): Link;
|
|
39
|
+
/**
|
|
40
|
+
* Typed helper for declaring a `<script>` element inside {@link useHead}.
|
|
41
|
+
*
|
|
42
|
+
* Known `type` values stay strict: `type: 'module'` still requires `src` or inline
|
|
43
|
+
* content, `type: 'application/ld+json'` still requires `textContent`, etc. Custom
|
|
44
|
+
* or non-standard `type` values (e.g. `'text/plain'`, `'text/html'`) are accepted
|
|
45
|
+
* via {@link GenericScript} without losing strictness on the rest of the union.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { defineScript, useHead } from 'unhead'
|
|
50
|
+
*
|
|
51
|
+
* useHead({
|
|
52
|
+
* script: [
|
|
53
|
+
* defineScript({ type: 'text/plain', textContent: 'debug-token' }),
|
|
54
|
+
* ],
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare function defineScript<const T extends object>(script: T & InferScript<T>): Script;
|
|
59
|
+
|
|
11
60
|
declare function createUnhead<T = ResolvableHead, R = unknown>(renderer: HeadRenderer<R>, resolvedOptions?: CreateHeadOptions): Unhead<T, R>;
|
|
12
61
|
|
|
13
|
-
export { createUnhead, useHead, useHeadSafe, useSeoMeta };
|
|
62
|
+
export { createUnhead, defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry, p as HeadRenderer, d as CreateHeadOptions } from './shared/unhead.
|
|
2
|
-
import {
|
|
3
|
-
import { H as HeadSafe } from './shared/unhead.
|
|
4
|
-
export { u as useScript } from './shared/unhead.
|
|
1
|
+
import { U as Unhead, k as HeadEntryOptions, A as ActiveHeadEntry, p as HeadRenderer, d as CreateHeadOptions } from './shared/unhead.BEof8Qjb.js';
|
|
2
|
+
import { as as ResolvableHead, b0 as UseSeoMetaInput, z as InferLink, T as Link, J as InferScript, aH as Script } from './shared/unhead.5pUZeb0i.js';
|
|
3
|
+
import { H as HeadSafe } from './shared/unhead.UFdAtJOd.js';
|
|
4
|
+
export { u as useScript } from './shared/unhead.vQPF0cJs.js';
|
|
5
5
|
import 'hookable';
|
|
6
6
|
|
|
7
7
|
declare function useHead<T extends Unhead<any>, I = ResolvableHead>(unhead: T, input?: ResolvableHead, options?: HeadEntryOptions): ActiveHeadEntry<I>;
|
|
8
8
|
declare function useHeadSafe<T extends Unhead<any>>(unhead: T, input?: HeadSafe, options?: HeadEntryOptions): ActiveHeadEntry<HeadSafe>;
|
|
9
9
|
declare function useSeoMeta<T extends Unhead<any>>(unhead: T, input?: UseSeoMetaInput, options?: HeadEntryOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Typed helper for declaring a `<link>` element inside {@link useHead}.
|
|
13
|
+
*
|
|
14
|
+
* Known `rel` values stay strict: `rel: 'preload'` still requires `as`,
|
|
15
|
+
* preload fonts still require `crossorigin`, `rel: 'mask-icon'` still requires
|
|
16
|
+
* `color`, etc. Non-standard `rel` values not covered by `KnownLinkRel` (e.g.
|
|
17
|
+
* OpenID endpoints, custom protocol discovery links) are accepted via
|
|
18
|
+
* `GenericLink` without losing strictness on the rest of the union.
|
|
19
|
+
*
|
|
20
|
+
* Standard rels like `'me'`, `'webmention'`, `'privacy-policy'`, and
|
|
21
|
+
* `'terms-of-service'` are already in the `Link` union, so they work with
|
|
22
|
+
* `useHead` directly without this helper.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { defineLink, useHead } from 'unhead'
|
|
27
|
+
*
|
|
28
|
+
* useHead({
|
|
29
|
+
* link: [
|
|
30
|
+
* defineLink({ rel: 'openid2.provider', href: 'https://example.com/openid' }),
|
|
31
|
+
* defineLink({ rel: 'EditURI', href: '/rsd.xml', type: 'application/rsd+xml' }),
|
|
32
|
+
* ],
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function defineLink<const T extends {
|
|
37
|
+
rel: string;
|
|
38
|
+
}>(link: T & InferLink<T>): Link;
|
|
39
|
+
/**
|
|
40
|
+
* Typed helper for declaring a `<script>` element inside {@link useHead}.
|
|
41
|
+
*
|
|
42
|
+
* Known `type` values stay strict: `type: 'module'` still requires `src` or inline
|
|
43
|
+
* content, `type: 'application/ld+json'` still requires `textContent`, etc. Custom
|
|
44
|
+
* or non-standard `type` values (e.g. `'text/plain'`, `'text/html'`) are accepted
|
|
45
|
+
* via {@link GenericScript} without losing strictness on the rest of the union.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { defineScript, useHead } from 'unhead'
|
|
50
|
+
*
|
|
51
|
+
* useHead({
|
|
52
|
+
* script: [
|
|
53
|
+
* defineScript({ type: 'text/plain', textContent: 'debug-token' }),
|
|
54
|
+
* ],
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare function defineScript<const T extends object>(script: T & InferScript<T>): Script;
|
|
59
|
+
|
|
11
60
|
declare function createUnhead<T = ResolvableHead, R = unknown>(renderer: HeadRenderer<R>, resolvedOptions?: CreateHeadOptions): Unhead<T, R>;
|
|
12
61
|
|
|
13
|
-
export { createUnhead, useHead, useHeadSafe, useSeoMeta };
|
|
62
|
+
export { createUnhead, defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
|
package/dist/index.mjs
CHANGED
|
@@ -35,4 +35,11 @@ function useSeoMeta(unhead, input = {}, options) {
|
|
|
35
35
|
return entry;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function defineLink(link) {
|
|
39
|
+
return link;
|
|
40
|
+
}
|
|
41
|
+
function defineScript(script) {
|
|
42
|
+
return script;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { defineLink, defineScript, useHead, useHeadSafe, useSeoMeta };
|
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.CyKsApKH.mjs';
|
|
2
|
+
import { s as HeadTag } from './shared/unhead.5pUZeb0i.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.BEof8Qjb.js';
|
|
2
|
+
import { s as HeadTag } from './shared/unhead.5pUZeb0i.js';
|
|
3
3
|
import 'hookable';
|
|
4
4
|
|
|
5
5
|
declare const AliasSortingPlugin: HeadPluginInput;
|
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.CyKsApKH.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.CyKsApKH.mjs';
|
|
3
|
+
export { u as useScript } from './shared/unhead.dhQT0IKI.mjs';
|
|
4
4
|
import 'hookable';
|
|
5
|
-
import './shared/unhead.
|
|
5
|
+
import './shared/unhead.5pUZeb0i.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.BEof8Qjb.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.BEof8Qjb.js';
|
|
3
|
+
export { u as useScript } from './shared/unhead.vQPF0cJs.js';
|
|
4
4
|
import 'hookable';
|
|
5
|
-
import './shared/unhead.
|
|
5
|
+
import './shared/unhead.5pUZeb0i.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.DvMT2vYs.mjs';
|
|
2
|
+
import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.CyKsApKH.mjs';
|
|
3
|
+
export { e as CreateServerHeadOptions } from './shared/unhead.CyKsApKH.mjs';
|
|
4
|
+
import { s as HeadTag } from './shared/unhead.5pUZeb0i.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.BRPfhzdc.js';
|
|
2
|
+
import { r as RenderSSRHeadOptions, p as HeadRenderer, s as SSRHeadPayload, U as Unhead } from './shared/unhead.BEof8Qjb.js';
|
|
3
|
+
export { e as CreateServerHeadOptions } from './shared/unhead.BEof8Qjb.js';
|
|
4
|
+
import { s as HeadTag } from './shared/unhead.5pUZeb0i.js';
|
|
5
5
|
import 'hookable';
|
|
6
6
|
|
|
7
7
|
declare function createServerRenderer(options?: RenderSSRHeadOptions): HeadRenderer<SSRHeadPayload>;
|
package/dist/server.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as renderSSRHead$1 } from './shared/unhead.
|
|
2
|
-
export { a as capoTagWeight, c as createHead, b as createServerRenderer, e as escapeHtml, p as propsToString, s as ssrRenderTags, t as tagToString } from './shared/unhead.
|
|
1
|
+
import { r as renderSSRHead$1 } from './shared/unhead.C5ypJnIO.mjs';
|
|
2
|
+
export { a as capoTagWeight, c as createHead, b as createServerRenderer, e as escapeHtml, p as propsToString, s as ssrRenderTags, t as tagToString } from './shared/unhead.C5ypJnIO.mjs';
|
|
3
3
|
import { parseHtmlForUnheadExtraction, applyHeadToHtml, parseHtmlForIndexes } from './parser.mjs';
|
|
4
4
|
import './shared/unhead.CfgPMHXt.mjs';
|
|
5
5
|
import './shared/unhead.DvIxXxuO.mjs';
|
|
6
6
|
import 'hookable';
|
|
7
|
-
import './shared/unhead.
|
|
7
|
+
import './shared/unhead.DiRbsb3I.mjs';
|
|
8
8
|
import './shared/unhead.fg-0ge_u.mjs';
|
|
9
9
|
|
|
10
10
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -878,20 +878,97 @@ interface PingbackLink extends LinkBase {
|
|
|
878
878
|
rel: 'pingback';
|
|
879
879
|
href: string;
|
|
880
880
|
}
|
|
881
|
+
/**
|
|
882
|
+
* Me link. Identifies the resource as representing the current user
|
|
883
|
+
* (IndieWeb / rel-me verification, Mastodon profile verification).
|
|
884
|
+
*
|
|
885
|
+
* @see https://html.spec.whatwg.org/multipage/links.html#link-type-me
|
|
886
|
+
*/
|
|
887
|
+
interface MeLink extends LinkBase {
|
|
888
|
+
rel: 'me';
|
|
889
|
+
href: string;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Privacy policy link.
|
|
893
|
+
*
|
|
894
|
+
* @see https://html.spec.whatwg.org/multipage/links.html#link-type-privacy-policy
|
|
895
|
+
*/
|
|
896
|
+
interface PrivacyPolicyLink extends LinkBase {
|
|
897
|
+
rel: 'privacy-policy';
|
|
898
|
+
href: string;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Terms of service link.
|
|
902
|
+
*
|
|
903
|
+
* @see https://html.spec.whatwg.org/multipage/links.html#link-type-terms-of-service
|
|
904
|
+
*/
|
|
905
|
+
interface TermsOfServiceLink extends LinkBase {
|
|
906
|
+
rel: 'terms-of-service';
|
|
907
|
+
href: string;
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Expect link. Blocks rendering until a named element is present and ready.
|
|
911
|
+
*
|
|
912
|
+
* @see https://html.spec.whatwg.org/multipage/links.html#link-type-expect
|
|
913
|
+
*/
|
|
914
|
+
interface ExpectLink extends LinkBase {
|
|
915
|
+
rel: 'expect';
|
|
916
|
+
href: string;
|
|
917
|
+
blocking?: 'render';
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Webmention endpoint link (IndieWeb).
|
|
921
|
+
*
|
|
922
|
+
* @see https://www.w3.org/TR/webmention/
|
|
923
|
+
*/
|
|
924
|
+
interface WebmentionLink extends LinkBase {
|
|
925
|
+
rel: 'webmention';
|
|
926
|
+
href: string;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Compression dictionary link (experimental).
|
|
930
|
+
*
|
|
931
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link#compression-dictionary
|
|
932
|
+
*/
|
|
933
|
+
interface CompressionDictionaryLink extends LinkBase {
|
|
934
|
+
rel: 'compression-dictionary';
|
|
935
|
+
href: string;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Alternate stylesheet link. User-selectable alternate stylesheet.
|
|
939
|
+
* Requires a `title` to appear in the browser's stylesheet picker.
|
|
940
|
+
*
|
|
941
|
+
* @see https://html.spec.whatwg.org/multipage/semantics.html#rel-alternate-stylesheet
|
|
942
|
+
*/
|
|
943
|
+
interface AlternateStylesheetLink extends LinkBase, LinkHttpEvents {
|
|
944
|
+
rel: 'alternate stylesheet';
|
|
945
|
+
href: string;
|
|
946
|
+
title: string;
|
|
947
|
+
media?: string;
|
|
948
|
+
crossorigin?: '' | 'anonymous' | 'use-credentials';
|
|
949
|
+
integrity?: string;
|
|
950
|
+
type?: 'text/css' | (string & Record<never, never>);
|
|
951
|
+
disabled?: boolean;
|
|
952
|
+
}
|
|
881
953
|
/**
|
|
882
954
|
* Union of all `rel` values that have narrowed link type definitions.
|
|
883
955
|
* Useful for building type guards or conditional logic based on `rel` values.
|
|
884
956
|
*/
|
|
885
|
-
type KnownLinkRel = 'stylesheet' | 'preload' | 'modulepreload' | 'prefetch' | 'icon' | 'shortcut icon' | 'apple-touch-icon' | 'mask-icon' | 'manifest' | 'canonical' | 'dns-prefetch' | 'preconnect' | 'prerender' | 'alternate' | 'author' | 'license' | 'help' | 'search' | 'prev' | 'next' | 'pingback';
|
|
957
|
+
type KnownLinkRel = 'stylesheet' | 'alternate stylesheet' | 'preload' | 'modulepreload' | 'prefetch' | 'icon' | 'shortcut icon' | 'apple-touch-icon' | 'mask-icon' | 'manifest' | 'canonical' | 'dns-prefetch' | 'preconnect' | 'prerender' | 'alternate' | 'author' | 'license' | 'help' | 'search' | 'prev' | 'next' | 'pingback' | 'me' | 'webmention' | 'privacy-policy' | 'terms-of-service' | 'expect' | 'compression-dictionary';
|
|
886
958
|
/**
|
|
887
959
|
* Fallback for custom or unknown `rel` types.
|
|
888
960
|
*
|
|
889
|
-
* Not included in the {@link Link} union to prevent silent absorption of known
|
|
890
|
-
*
|
|
961
|
+
* Not included in the {@link Link} union to prevent silent absorption of known
|
|
962
|
+
* `rel` values (e.g. so `rel: 'preload'` without `as` stays an error instead of
|
|
963
|
+
* collapsing into this permissive shape).
|
|
964
|
+
*
|
|
965
|
+
* For non-standard `rel` values not covered by {@link KnownLinkRel}, prefer
|
|
966
|
+
* {@link defineLink}, which enforces strict narrowing on known rels while
|
|
967
|
+
* accepting `GenericLink` for anything else:
|
|
891
968
|
*
|
|
892
969
|
* ```ts
|
|
893
|
-
* import
|
|
894
|
-
* useHead({ link: [{ rel: '
|
|
970
|
+
* import { defineLink } from 'unhead'
|
|
971
|
+
* useHead({ link: [defineLink({ rel: 'openid2.provider', href: 'https://...' })] })
|
|
895
972
|
* ```
|
|
896
973
|
*/
|
|
897
974
|
interface GenericLink extends LinkBase {
|
|
@@ -918,15 +995,33 @@ interface GenericLink extends LinkBase {
|
|
|
918
995
|
* attributes. For example, `rel="preload"` requires the `as` attribute (see {@link PreloadLink}),
|
|
919
996
|
* and `rel="mask-icon"` requires `color` (see {@link MaskIconLink}).
|
|
920
997
|
*
|
|
921
|
-
* For
|
|
998
|
+
* For non-standard `rel` values not covered by {@link KnownLinkRel}, use {@link defineLink}:
|
|
922
999
|
* ```ts
|
|
923
|
-
* import
|
|
924
|
-
* useHead({ link: [{ rel: '
|
|
1000
|
+
* import { defineLink } from 'unhead'
|
|
1001
|
+
* useHead({ link: [defineLink({ rel: 'openid2.provider', href: 'https://...' })] })
|
|
925
1002
|
* ```
|
|
926
1003
|
*
|
|
927
1004
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
|
|
928
1005
|
*/
|
|
929
|
-
type Link = StylesheetLink | PreloadLink | ModulepreloadLink | PrefetchLink | FaviconLink | AppleTouchIconLink | MaskIconLink | ManifestLink | CanonicalLink | DnsPrefetchLink | PreconnectLink | PrerenderLink | AlternateLanguageLink | AlternateFeedLink | AlternateMediaLink | BareAlternateLink | AuthorLink | LicenseLink | HelpLink | SearchLink | PrevLink | NextLink | PingbackLink;
|
|
1006
|
+
type Link = StylesheetLink | AlternateStylesheetLink | PreloadLink | ModulepreloadLink | PrefetchLink | FaviconLink | AppleTouchIconLink | MaskIconLink | ManifestLink | CanonicalLink | DnsPrefetchLink | PreconnectLink | PrerenderLink | AlternateLanguageLink | AlternateFeedLink | AlternateMediaLink | BareAlternateLink | AuthorLink | LicenseLink | HelpLink | SearchLink | PrevLink | NextLink | PingbackLink | MeLink | WebmentionLink | PrivacyPolicyLink | TermsOfServiceLink | ExpectLink | CompressionDictionaryLink;
|
|
1007
|
+
/**
|
|
1008
|
+
* Pick {@link Link} union members whose `rel` accepts `R`.
|
|
1009
|
+
*
|
|
1010
|
+
* Unlike `Extract<Link, { rel: R }>`, this handles members whose `rel` is itself
|
|
1011
|
+
* a union (e.g. {@link FaviconLink}'s `'icon' | 'shortcut icon'`).
|
|
1012
|
+
*/
|
|
1013
|
+
type MatchLinkByRel<R> = Link extends infer M ? M extends {
|
|
1014
|
+
rel: infer MR;
|
|
1015
|
+
} ? R extends MR ? M : never : never : never;
|
|
1016
|
+
/**
|
|
1017
|
+
* Resolve a single link input to either its strict {@link Link} variant (when
|
|
1018
|
+
* `rel` is a {@link KnownLinkRel}) or {@link GenericLink} (for custom rels).
|
|
1019
|
+
*/
|
|
1020
|
+
type InferLink<T> = T extends {
|
|
1021
|
+
rel: infer R;
|
|
1022
|
+
} ? R extends KnownLinkRel ? MatchLinkByRel<R> : R extends string ? GenericLink & {
|
|
1023
|
+
rel: R;
|
|
1024
|
+
} : never : never;
|
|
930
1025
|
|
|
931
1026
|
/**
|
|
932
1027
|
* Known meta name values
|
|
@@ -2109,14 +2204,16 @@ interface NoLoadableScriptProps {
|
|
|
2109
2204
|
nomodule?: never;
|
|
2110
2205
|
}
|
|
2111
2206
|
/**
|
|
2112
|
-
* Content for data scripts
|
|
2207
|
+
* Content for data scripts — requires exactly one of `textContent` or
|
|
2208
|
+
* `innerHTML`. Data scripts (JSON-LD, speculation rules, application/json) must
|
|
2209
|
+
* carry inline content; an empty payload is invalid.
|
|
2113
2210
|
*/
|
|
2114
2211
|
type DataScriptTextContent<T = string | Record<string, unknown>> = {
|
|
2115
2212
|
/**
|
|
2116
2213
|
* Sets the textContent of an element. Safer for XSS.
|
|
2117
2214
|
* Can be a string or an object that will be serialized to JSON.
|
|
2118
2215
|
*/
|
|
2119
|
-
textContent
|
|
2216
|
+
textContent: T;
|
|
2120
2217
|
innerHTML?: never;
|
|
2121
2218
|
} | {
|
|
2122
2219
|
textContent?: never;
|
|
@@ -2124,7 +2221,7 @@ type DataScriptTextContent<T = string | Record<string, unknown>> = {
|
|
|
2124
2221
|
* Sets the innerHTML of an element.
|
|
2125
2222
|
* Can be a string or an object that will be serialized to JSON.
|
|
2126
2223
|
*/
|
|
2127
|
-
innerHTML
|
|
2224
|
+
innerHTML: T;
|
|
2128
2225
|
};
|
|
2129
2226
|
/**
|
|
2130
2227
|
* External JavaScript (fires events)
|
|
@@ -2307,7 +2404,7 @@ interface ImportMapConfig {
|
|
|
2307
2404
|
scopes?: Record<string, Record<string, string>>;
|
|
2308
2405
|
}
|
|
2309
2406
|
/**
|
|
2310
|
-
* Import map
|
|
2407
|
+
* Import map. Requires either `textContent` (recommended) or `innerHTML`.
|
|
2311
2408
|
*/
|
|
2312
2409
|
type ImportMapScript = ScriptBase & NoLoadableScriptProps & {
|
|
2313
2410
|
/**
|
|
@@ -2317,13 +2414,15 @@ type ImportMapScript = ScriptBase & NoLoadableScriptProps & {
|
|
|
2317
2414
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
|
|
2318
2415
|
*/
|
|
2319
2416
|
type: 'importmap';
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
* Can be a string or an ImportMapConfig object that will be serialized to JSON.
|
|
2323
|
-
*/
|
|
2417
|
+
} & ({
|
|
2418
|
+
/** Import map content as a string or ImportMapConfig object (auto-serialized). */
|
|
2324
2419
|
textContent: string | ImportMapConfig;
|
|
2325
2420
|
innerHTML?: never;
|
|
2326
|
-
}
|
|
2421
|
+
} | {
|
|
2422
|
+
textContent?: never;
|
|
2423
|
+
/** Import map content as a string or ImportMapConfig object (auto-serialized). */
|
|
2424
|
+
innerHTML: string | ImportMapConfig;
|
|
2425
|
+
});
|
|
2327
2426
|
/**
|
|
2328
2427
|
* Application JSON script (generic JSON data)
|
|
2329
2428
|
*/
|
|
@@ -2339,12 +2438,16 @@ type ApplicationJsonScript = ScriptBase & NoLoadableScriptProps & DataScriptText
|
|
|
2339
2438
|
/**
|
|
2340
2439
|
* Fallback for custom or unknown `type` values.
|
|
2341
2440
|
*
|
|
2342
|
-
* Not included in the {@link Script} union to prevent silent absorption of known
|
|
2343
|
-
*
|
|
2441
|
+
* Not included in the {@link Script} union to prevent silent absorption of known
|
|
2442
|
+
* `type` values (e.g. so `type: 'module'` without `src` or inline content stays
|
|
2443
|
+
* an error instead of collapsing into this permissive shape).
|
|
2444
|
+
*
|
|
2445
|
+
* For custom `type` values, prefer {@link defineScript}, which enforces strict
|
|
2446
|
+
* narrowing on known types while accepting `GenericScript` for anything else:
|
|
2344
2447
|
*
|
|
2345
2448
|
* ```ts
|
|
2346
|
-
* import
|
|
2347
|
-
* useHead({ script: [{ type: 'text/plain', textContent: '...' }
|
|
2449
|
+
* import { defineScript } from 'unhead'
|
|
2450
|
+
* useHead({ script: [defineScript({ type: 'text/plain', textContent: '...' })] })
|
|
2348
2451
|
* ```
|
|
2349
2452
|
*/
|
|
2350
2453
|
interface GenericScript extends ScriptBase, ScriptHttpEvents {
|
|
@@ -2420,13 +2523,38 @@ interface GenericScript extends ScriptBase, ScriptHttpEvents {
|
|
|
2420
2523
|
* Each `type` value maps to a specific interface that enforces per-type constraints.
|
|
2421
2524
|
* For example, inline scripts require `textContent` and forbid `src`/`async`/`defer`.
|
|
2422
2525
|
*
|
|
2423
|
-
* For custom or non-standard `type` values, use {@link
|
|
2526
|
+
* For custom or non-standard `type` values, use {@link defineScript}:
|
|
2424
2527
|
* ```ts
|
|
2425
|
-
* import
|
|
2426
|
-
* useHead({ script: [{ type: 'text/plain', textContent: '...' }
|
|
2528
|
+
* import { defineScript } from 'unhead'
|
|
2529
|
+
* useHead({ script: [defineScript({ type: 'text/plain', textContent: '...' })] })
|
|
2427
2530
|
* ```
|
|
2428
2531
|
*/
|
|
2429
2532
|
type Script = ExternalScript | ModuleScript | InlineScript | InlineModuleScript | JsonLdScript | SpeculationRulesScript | ImportMapScript | ApplicationJsonScript;
|
|
2533
|
+
/**
|
|
2534
|
+
* Union of all `type` values that have narrowed script type definitions.
|
|
2535
|
+
*/
|
|
2536
|
+
type KnownScriptType = '' | 'text/javascript' | 'module' | 'application/ld+json' | 'speculationrules' | 'importmap' | 'application/json';
|
|
2537
|
+
/**
|
|
2538
|
+
* Pick {@link Script} union members whose `type` accepts `U`.
|
|
2539
|
+
*
|
|
2540
|
+
* Handles members whose `type` is itself a union (e.g. {@link ExternalScript}'s
|
|
2541
|
+
* `'' | 'text/javascript'`), and members where `type` is optional.
|
|
2542
|
+
*/
|
|
2543
|
+
type MatchScriptByType<U> = Script extends infer M ? M extends {
|
|
2544
|
+
type?: infer MT;
|
|
2545
|
+
} ? U extends MT ? M : never : never : never;
|
|
2546
|
+
/**
|
|
2547
|
+
* Resolve a single script input to either its strict {@link Script} variant (when
|
|
2548
|
+
* `type` is a {@link KnownScriptType}) or {@link GenericScript} (for custom types).
|
|
2549
|
+
*
|
|
2550
|
+
* When no `type` field is present, or `type` is non-string, the full {@link Script}
|
|
2551
|
+
* union is returned so discriminators like `src` vs `textContent` still apply.
|
|
2552
|
+
*/
|
|
2553
|
+
type InferScript<T> = T extends {
|
|
2554
|
+
type: infer U;
|
|
2555
|
+
} ? U extends string ? U extends KnownScriptType ? MatchScriptByType<U> : GenericScript & {
|
|
2556
|
+
type: U;
|
|
2557
|
+
} : Script : Script;
|
|
2430
2558
|
|
|
2431
2559
|
interface Style extends Pick<GlobalAttributes, 'nonce' | 'id'>, Blocking {
|
|
2432
2560
|
/**
|
|
@@ -2745,4 +2873,4 @@ interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTempl
|
|
|
2745
2873
|
}
|
|
2746
2874
|
type HeadTagKeys = (keyof HeadTag)[];
|
|
2747
2875
|
|
|
2748
|
-
export type {
|
|
2876
|
+
export type { Meta as $, AlternateFeedLink as A, Booleanable as B, CanonicalLink as C, DataKeys as D, ExpectLink as E, FaviconLink as F, GenericLink as G, HasTemplateParams as H, IconLink as I, InferScript as J, InlineModuleScript as K, InlineScript as L, InnerContent as M, InnerContentVal as N, InternalTagKey as O, JsonLdScript as P, KnownLinkRel as Q, KnownScriptType as R, LicenseLink as S, Link as T, LinkBase as U, LinkHttpEvents as V, ManifestLink as W, MaskIconLink as X, MaybeArray as Y, MaybeEventFnHandlers as Z, MeLink as _, AlternateLanguageLink as a, UseHeadInput as a$, MetaBase as a0, MetaFlat as a1, MetaGeneric as a2, MetaNames as a3, MetaProperties as a4, ModuleScript as a5, ModulepreloadLink as a6, NameMeta as a7, Never as a8, NextLink as a9, ResolvableTemplateParams as aA, ResolvableTitle as aB, ResolvableTitleTemplate as aC, ResolvableUnion as aD, ResolvableValue as aE, ResolvesDuplicates as aF, SchemaAugmentations as aG, Script as aH, ScriptBase as aI, ScriptHttpEvents as aJ, SearchLink as aK, SerializableHead as aL, SpeculationRules as aM, SpeculationRulesScript as aN, StringInnerContent as aO, Stringable as aP, StylesheetLink as aQ, TagKey as aR, TagPosition as aS, TagPriority as aT, TagUserProperties as aU, TemplateParams as aV, TemplateParamsAugmentations as aW, TermsOfServiceLink as aX, UnheadBodyAttributesWithoutEvents as aY, UnheadHtmlAttributes as aZ, UnheadMeta as a_, PingbackLink as aa, PreconnectLink as ab, PrefetchLink as ac, PreloadFontLink as ad, PreloadImageLink as ae, PreloadLink as af, PreloadLinkBase as ag, PreloadOtherLink as ah, PreloadScriptLink as ai, PreloadStyleLink as aj, PrerenderLink as ak, PrevLink as al, PrivacyPolicyLink as am, ProcessesTemplateParams as an, PropertyMeta as ao, RawInput as ap, ResolvableBase as aq, ResolvableBodyAttributes as ar, ResolvableHead as as, ResolvableHtmlAttributes as at, ResolvableLink as au, ResolvableMeta as av, ResolvableNoscript as aw, ResolvableProperties as ax, ResolvableScript as ay, ResolvableStyle as az, AlternateLink as b, UseSeoMetaInput as b0, ValidTagPositions as b1, WebmentionLink as b2, AlternateMediaLink as c, AlternateStylesheetLink as d, AppleTouchIconLink as e, ApplicationJsonScript as f, Arrayable as g, AuthorLink as h, BareAlternateLink as i, BodyAttributesWithoutEvents as j, BodyEvents as k, CharsetMeta as l, CompressionDictionaryLink as m, DeepResolvableProperties as n, DnsPrefetchLink as o, ExternalScript as p, GenericScript as q, GlobalAttributes as r, HeadTag as s, HeadTagKeys as t, HelpLink as u, HttpEquivMeta as v, HttpEventAttributes as w, ImportMapConfig as x, ImportMapScript as y, InferLink as z };
|