unhead 3.1.3 → 3.1.5
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 +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/legacy.d.mts +3 -3
- package/dist/legacy.d.ts +3 -3
- package/dist/legacy.mjs +7 -7
- package/dist/parser.d.mts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/parser.mjs +1 -3
- package/dist/plugins.d.mts +4 -4
- package/dist/plugins.d.ts +4 -4
- package/dist/plugins.mjs +4 -4
- package/dist/scripts.d.mts +4 -4
- package/dist/scripts.d.ts +4 -4
- package/dist/scripts.mjs +2 -2
- package/dist/server.d.mts +8 -7
- package/dist/server.d.ts +8 -7
- package/dist/server.mjs +4 -9
- package/dist/shared/{unhead.ekDpYRjs.d.mts → unhead.B37CPNIq.d.mts} +2 -2
- package/dist/shared/{unhead.BnlR_jz2.d.mts → unhead.BO2PdEL4.d.mts} +1 -1
- package/dist/shared/{unhead.CJY-UeEt.mjs → unhead.BSqa2bYq.mjs} +4 -4
- package/dist/shared/{unhead.jqONLOUN.d.ts → unhead.BWKj-eGY.d.ts} +2 -2
- package/dist/shared/{unhead.CH30252c.mjs → unhead.BZYKjYpn.mjs} +1 -1
- package/dist/shared/{unhead.ByB97_5N.d.mts → unhead.BeIvDlYY.d.mts} +2 -2
- package/dist/shared/{unhead.BHr5MNkJ.d.ts → unhead.BhvKU-Uu.d.ts} +2 -2
- package/dist/shared/{unhead.CKu1VBXp.d.ts → unhead.Blkhu0Cr.d.ts} +2 -2
- package/dist/shared/{unhead.CnNMu1HU.d.ts → unhead.CBj56GgY.d.ts} +2 -2
- package/dist/shared/{unhead.JWUDzlIs.mjs → unhead.CBkhoTGw.mjs} +3 -1
- package/dist/shared/{unhead.DjnbVGfW.d.mts → unhead.CRVUlr67.d.mts} +2 -2
- package/dist/shared/{unhead.BNptCUyv.d.mts → unhead.CS8tFxG3.d.mts} +2 -2
- package/dist/shared/{unhead.BjuLn3hu.mjs → unhead.CT3gGqve.mjs} +2 -2
- package/dist/shared/{unhead.f0Z4Ygga.d.ts → unhead.CpKzP6LT.d.mts} +1 -1
- package/dist/shared/{unhead.B3gLwi_2.mjs → unhead.D-W0R71w.mjs} +36 -54
- package/dist/shared/{unhead.CJ5MDR84.d.ts → unhead.DEgm41PJ.d.ts} +1 -1
- package/dist/shared/{unhead.Bz11580x.d.mts → unhead.Dl7UHSN0.d.mts} +51 -4
- package/dist/shared/{unhead.Bz11580x.d.ts → unhead.Dl7UHSN0.d.ts} +51 -4
- package/dist/shared/{unhead.DsqXiUvy.d.ts → unhead.Dl_lRDXb.d.mts} +2 -2
- package/dist/shared/{unhead.DsqXiUvy.d.mts → unhead.Dl_lRDXb.d.ts} +2 -2
- package/dist/shared/{unhead.A4ndrqqe.mjs → unhead.Doc2Fa-a.mjs} +1 -1
- package/dist/shared/{unhead.CG80LYNi.d.mts → unhead.Dqn7v3Di.d.ts} +1 -1
- package/dist/shared/{unhead.mB5lMBMV.mjs → unhead.DvIxXxuO.mjs} +1 -1
- package/dist/shared/{unhead.Brajh4vg.d.mts → unhead.GpD0t1jW.d.mts} +1 -1
- package/dist/shared/{unhead.DzSj5qjO.mjs → unhead.H5gLMTHA.mjs} +40 -15
- package/dist/shared/{unhead.eQfSuvE2.mjs → unhead.J7mPNB3E.mjs} +2 -2
- package/dist/shared/{unhead.ebqUBTt1.mjs → unhead.WR8XDfSi.mjs} +9 -1
- package/dist/shared/{unhead.Dc4-12pQ.d.ts → unhead.YBmQyFpm.d.ts} +1 -1
- package/dist/stream/client.d.mts +3 -3
- package/dist/stream/client.d.ts +3 -3
- package/dist/stream/client.mjs +1 -1
- 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 +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/dist/utils.mjs +3 -3
- package/dist/validate.d.mts +2 -2
- package/dist/validate.d.ts +2 -2
- package/dist/validate.mjs +1 -1
- package/package.json +2 -24
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { c as createUnhead, r as registerPlugin } from './unhead.CfgPMHXt.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import { r as resolveTags } from './unhead.
|
|
2
|
+
import { a as callHook, c as createHooks } from './unhead.DvIxXxuO.mjs';
|
|
3
|
+
import { r as resolveTags } from './unhead.H5gLMTHA.mjs';
|
|
4
4
|
import { b as TagPriorityAliases, c as TagsWithInnerContent, a as SelfClosingTags } from './unhead.fg-0ge_u.mjs';
|
|
5
5
|
|
|
6
6
|
const TAG_WEIGHTS = { base: -10, title: 10 };
|
|
7
|
-
const
|
|
8
|
-
meta: { "content-security-policy": -30, "charset": -20, "viewport": -15 },
|
|
9
|
-
link: { "preconnect": 20, "stylesheet": 60, "preload": 70, "modulepreload": 70, "prefetch": 90, "dns-prefetch": 90, "prerender": 90 },
|
|
10
|
-
script: { importmap: 25, async: 30, defer: 80, sync: 50, speculationrules: 90 },
|
|
11
|
-
style: { imported: 40, sync: 60 }
|
|
12
|
-
};
|
|
7
|
+
const LINK_WEIGHTS = { "preconnect": 20, "stylesheet": 60, "preload": 70, "modulepreload": 70, "prefetch": 90, "dns-prefetch": 90, "prerender": 90 };
|
|
13
8
|
const ImportStyleRe = /@import/;
|
|
14
9
|
const isTruthy = (v) => v === "" || v === true;
|
|
15
10
|
function capoTagWeight(tag) {
|
|
@@ -20,32 +15,32 @@ function capoTagWeight(tag) {
|
|
|
20
15
|
if (tag.tag in TAG_WEIGHTS) {
|
|
21
16
|
weight = TAG_WEIGHTS[tag.tag];
|
|
22
17
|
} else if (tag.tag === "meta") {
|
|
23
|
-
|
|
24
|
-
if (t)
|
|
25
|
-
weight = CAPO_WEIGHTS.meta[t];
|
|
18
|
+
weight = tag.props["http-equiv"] === "content-security-policy" ? -30 : tag.props.charset ? -20 : tag.props.name === "viewport" ? -15 : weight;
|
|
26
19
|
} else if (tag.tag === "link" && tag.props.rel) {
|
|
27
|
-
weight =
|
|
20
|
+
weight = LINK_WEIGHTS[tag.props.rel];
|
|
28
21
|
} else if (tag.tag === "script") {
|
|
29
22
|
const type = String(tag.props.type);
|
|
23
|
+
const json = type.endsWith("json");
|
|
30
24
|
if (type === "importmap")
|
|
31
|
-
weight =
|
|
25
|
+
weight = 25;
|
|
32
26
|
else if (type === "speculationrules")
|
|
33
|
-
weight =
|
|
27
|
+
weight = 90;
|
|
34
28
|
else if (isTruthy(tag.props.async))
|
|
35
|
-
weight =
|
|
36
|
-
else if (tag.props.src && !isTruthy(tag.props.defer) &&
|
|
37
|
-
weight =
|
|
38
|
-
else if (isTruthy(tag.props.defer) && tag.props.src
|
|
39
|
-
weight =
|
|
29
|
+
weight = 30;
|
|
30
|
+
else if (tag.props.src && !isTruthy(tag.props.defer) && type !== "module" && !json || (tag.innerHTML || tag.textContent) && !json)
|
|
31
|
+
weight = 50;
|
|
32
|
+
else if (isTruthy(tag.props.defer) && tag.props.src || type === "module")
|
|
33
|
+
weight = 80;
|
|
40
34
|
} else if (tag.tag === "style") {
|
|
41
|
-
weight = tag.innerHTML && ImportStyleRe.test(tag.innerHTML) ?
|
|
35
|
+
weight = tag.innerHTML && ImportStyleRe.test(tag.innerHTML) ? 40 : 60;
|
|
42
36
|
}
|
|
43
37
|
return (weight || 100) + offset;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
const DOUBLE_QUOTE_RE = /"/g;
|
|
47
41
|
function encodeAttribute(value) {
|
|
48
|
-
|
|
42
|
+
const s = typeof value === "string" ? value : String(value);
|
|
43
|
+
return s.includes('"') ? s.replace(DOUBLE_QUOTE_RE, """) : s;
|
|
49
44
|
}
|
|
50
45
|
function propsToString(props) {
|
|
51
46
|
let attrs = "";
|
|
@@ -64,25 +59,10 @@ function propsToString(props) {
|
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
const ESCAPE_HTML_RE = /[&<>"'/]/g;
|
|
62
|
+
const CLOSE_TAG_RE = {};
|
|
63
|
+
const ESCAPE_HTML_MAP = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "/": "/" };
|
|
67
64
|
function escapeHtml(str) {
|
|
68
|
-
return str.replace(ESCAPE_HTML_RE, (
|
|
69
|
-
switch (char) {
|
|
70
|
-
case "&":
|
|
71
|
-
return "&";
|
|
72
|
-
case "<":
|
|
73
|
-
return "<";
|
|
74
|
-
case ">":
|
|
75
|
-
return ">";
|
|
76
|
-
case '"':
|
|
77
|
-
return """;
|
|
78
|
-
case "'":
|
|
79
|
-
return "'";
|
|
80
|
-
case "/":
|
|
81
|
-
return "/";
|
|
82
|
-
default:
|
|
83
|
-
return char;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
65
|
+
return str.replace(ESCAPE_HTML_RE, (c) => ESCAPE_HTML_MAP[c]);
|
|
86
66
|
}
|
|
87
67
|
function tagToString(tag) {
|
|
88
68
|
const attrs = propsToString(tag.props);
|
|
@@ -90,7 +70,7 @@ function tagToString(tag) {
|
|
|
90
70
|
if (!TagsWithInnerContent.has(tag.tag))
|
|
91
71
|
return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}</${tag.tag}>`;
|
|
92
72
|
let content = String(tag.textContent || tag.innerHTML || "");
|
|
93
|
-
content = tag.tag === "title" ? escapeHtml(content) : content.replace(new RegExp(`</${tag.tag}`, "gi"), `<\\/${tag.tag}`);
|
|
73
|
+
content = tag.tag === "title" ? escapeHtml(content) : content.replace(CLOSE_TAG_RE[tag.tag] ||= new RegExp(`</${tag.tag}`, "gi"), `<\\/${tag.tag}`);
|
|
94
74
|
return SelfClosingTags.has(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
|
|
95
75
|
}
|
|
96
76
|
|
|
@@ -183,25 +163,27 @@ function createHead(options = {}) {
|
|
|
183
163
|
};
|
|
184
164
|
options.plugins?.forEach((p) => registerPlugin(head, p));
|
|
185
165
|
head._ssrPayload = {};
|
|
166
|
+
const payloadHook = (ctx) => {
|
|
167
|
+
let payload = {};
|
|
168
|
+
if (Object.keys(head._ssrPayload || {}).length > 0) {
|
|
169
|
+
payload = { ...head._ssrPayload };
|
|
170
|
+
}
|
|
171
|
+
if (Object.values(payload).some(Boolean)) {
|
|
172
|
+
ctx.tags.push({
|
|
173
|
+
tag: "script",
|
|
174
|
+
innerHTML: JSON.stringify(payload),
|
|
175
|
+
props: { id: "unhead:payload", type: "application/json" }
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
payloadHook._nonMutating = true;
|
|
186
180
|
registerPlugin(head, {
|
|
187
181
|
key: "server",
|
|
188
182
|
hooks: {
|
|
189
|
-
"tags:resolve":
|
|
190
|
-
let payload = {};
|
|
191
|
-
if (Object.keys(head._ssrPayload || {}).length > 0) {
|
|
192
|
-
payload = { ...head._ssrPayload };
|
|
193
|
-
}
|
|
194
|
-
if (Object.values(payload).some(Boolean)) {
|
|
195
|
-
ctx.tags.push({
|
|
196
|
-
tag: "script",
|
|
197
|
-
innerHTML: JSON.stringify(payload),
|
|
198
|
-
props: { id: "unhead:payload", type: "application/json" }
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
183
|
+
"tags:resolve": payloadHook
|
|
202
184
|
}
|
|
203
185
|
});
|
|
204
186
|
return head;
|
|
205
187
|
}
|
|
206
188
|
|
|
207
|
-
export {
|
|
189
|
+
export { capoTagWeight as a, createServerRenderer as b, createHead as c, escapeHtml as e, propsToString as p, renderSSRHead as r, ssrRenderTags as s, tagToString as t };
|
|
@@ -1095,7 +1095,7 @@ type MetaNames = 'apple-itunes-app' | 'apple-mobile-web-app-capable' | 'apple-mo
|
|
|
1095
1095
|
/**
|
|
1096
1096
|
* Known meta property values (OpenGraph, etc.)
|
|
1097
1097
|
*/
|
|
1098
|
-
type MetaProperties = 'article:author' | 'article:expiration_time' | 'article:modified_time' | 'article:published_time' | 'article:section' | 'article:tag' | 'book:author' | 'book:isbn' | 'book:release_date' | 'book:tag' | 'fb:app:id' | 'og:audio:secure_url' | 'og:audio:type' | 'og:audio:url' | 'og:description' | 'og:determiner' | 'og:image:height' | 'og:image:secure_url' | 'og:image:type' | 'og:image:url' | 'og:image:width' | 'og:image' | 'og:locale:alternate' | 'og:locale' | 'og:site:name' | 'og:title' | 'og:type' | 'og:url' | 'og:video:height' | 'og:video:secure_url' | 'og:video:type' | 'og:video:url' | 'og:video:width' | 'og:video' | 'profile:first_name' | 'profile:gender' | 'profile:last_name' | 'profile:username';
|
|
1098
|
+
type MetaProperties = 'article:author' | 'article:expiration_time' | 'article:modified_time' | 'article:published_time' | 'article:section' | 'article:tag' | 'book:author' | 'book:isbn' | 'book:release_date' | 'book:tag' | 'fb:app:id' | 'og:audio:secure_url' | 'og:audio:type' | 'og:audio:url' | 'og:description' | 'og:determiner' | 'og:image:height' | 'og:image:secure_url' | 'og:image:type' | 'og:image:url' | 'og:image:width' | 'og:image' | 'og:locale:alternate' | 'og:locale' | 'og:site:name' | 'og:title' | 'og:type' | 'og:url' | 'og:video:height' | 'og:video:secure_url' | 'og:video:type' | 'og:video:url' | 'og:video:width' | 'og:video' | 'payment:amount' | 'payment:currency' | 'payment:description' | 'payment:expires_at' | 'payment:id' | 'payment:status' | 'payment:success_url' | 'profile:first_name' | 'profile:gender' | 'profile:last_name' | 'profile:username';
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Base properties shared by all meta types
|
|
1101
1101
|
*/
|
|
@@ -1266,7 +1266,54 @@ interface MetaFlatProfile {
|
|
|
1266
1266
|
*/
|
|
1267
1267
|
profileUsername?: string;
|
|
1268
1268
|
}
|
|
1269
|
-
interface
|
|
1269
|
+
interface MetaFlatPayment {
|
|
1270
|
+
/**
|
|
1271
|
+
* Description about the payment link.
|
|
1272
|
+
*
|
|
1273
|
+
* @see https://ogp.me/ns/payment#
|
|
1274
|
+
*/
|
|
1275
|
+
paymentDescription?: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* The currency code ISO 4217 of the payment.
|
|
1278
|
+
* @example 'USD'
|
|
1279
|
+
*
|
|
1280
|
+
* @see https://ogp.me/ns/payment#
|
|
1281
|
+
*/
|
|
1282
|
+
paymentCurrency?: string;
|
|
1283
|
+
/**
|
|
1284
|
+
* An amount requested on the payment link in decimal format.
|
|
1285
|
+
* @example 19.99
|
|
1286
|
+
*
|
|
1287
|
+
* @see https://ogp.me/ns/payment#
|
|
1288
|
+
*/
|
|
1289
|
+
paymentAmount?: string | number;
|
|
1290
|
+
/**
|
|
1291
|
+
* The date and time including minutes and seconds on which the payment link expires.
|
|
1292
|
+
* @example '1970-01-01T00:00:00.000Z'
|
|
1293
|
+
*
|
|
1294
|
+
* @see https://ogp.me/ns/payment#
|
|
1295
|
+
*/
|
|
1296
|
+
paymentExpiresAt?: string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Status of the payment.
|
|
1299
|
+
*
|
|
1300
|
+
* @see https://ogp.me/ns/payment#
|
|
1301
|
+
*/
|
|
1302
|
+
paymentStatus?: 'PENDING' | 'PAID' | 'FAILED' | 'EXPIRED';
|
|
1303
|
+
/**
|
|
1304
|
+
* The unique identifier associated with the payment link for a given payment gateway or service provider.
|
|
1305
|
+
*
|
|
1306
|
+
* @see https://ogp.me/ns/payment#
|
|
1307
|
+
*/
|
|
1308
|
+
paymentId?: string;
|
|
1309
|
+
/**
|
|
1310
|
+
* A valid URL that gets redirected when payment is success.
|
|
1311
|
+
*
|
|
1312
|
+
* @see https://ogp.me/ns/payment#
|
|
1313
|
+
*/
|
|
1314
|
+
paymentSuccessUrl?: string;
|
|
1315
|
+
}
|
|
1316
|
+
interface MetaFlat extends MetaFlatArticle, MetaFlatBook, MetaFlatProfile, MetaFlatPayment {
|
|
1270
1317
|
/**
|
|
1271
1318
|
* This attribute declares the document's character encoding.
|
|
1272
1319
|
* If the attribute is present, its value must be an ASCII case-insensitive match for the string "utf-8",
|
|
@@ -1551,7 +1598,7 @@ interface MetaFlat extends MetaFlatArticle, MetaFlatBook, MetaFlatProfile {
|
|
|
1551
1598
|
*
|
|
1552
1599
|
* @see https://ogp.me/#metadata
|
|
1553
1600
|
*/
|
|
1554
|
-
ogType?: 'website' | 'article' | 'book' | 'profile' | 'music.song' | 'music.album' | 'music.playlist' | 'music.
|
|
1601
|
+
ogType?: 'website' | 'article' | 'book' | 'profile' | 'music.song' | 'music.album' | 'music.playlist' | 'music.radio_station' | 'video.movie' | 'video.episode' | 'video.tv_show' | 'video.other' | 'payment.link';
|
|
1555
1602
|
/**
|
|
1556
1603
|
* The locale of the resource. Defaults to en_US.
|
|
1557
1604
|
*
|
|
@@ -2976,4 +3023,4 @@ interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTempl
|
|
|
2976
3023
|
}
|
|
2977
3024
|
type HeadTagKeys = (keyof HeadTag)[];
|
|
2978
3025
|
|
|
2979
|
-
export type {
|
|
3026
|
+
export type { LinkHttpEvents 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, HubLink as I, IconLink as J, ImportMapConfig as K, ImportMapScript as L, InferLink as M, InferScript as N, InlineModuleScript as O, InlineScript as P, InnerContent as Q, ResolvableHead as R, SerializableHead as S, InnerContentVal as T, InternalTagKey as U, JsonLdScript as V, KnownLinkRel as W, KnownScriptType as X, LicenseLink as Y, Link as Z, LinkBase as _, AlternateLanguageLink as a, TemplateParamsAugmentations as a$, ManifestLink as a0, MaskIconLink as a1, MaybeArray as a2, MaybeEventFnHandlers as a3, MeLink as a4, Meta as a5, MetaBase as a6, MetaFlat as a7, MetaGeneric as a8, MetaNames as a9, ResolvableMeta as aA, ResolvableNoscript as aB, ResolvableProperties as aC, ResolvableScript as aD, ResolvableStyle as aE, ResolvableTemplateParams as aF, ResolvableTitle as aG, ResolvableTitleTemplate as aH, ResolvableUnion as aI, ResolvableValue as aJ, ResolvesDuplicates as aK, SchemaAugmentations as aL, Script as aM, ScriptBase as aN, ScriptHttpEvents as aO, SearchLink as aP, SitemapLink as aQ, SpeculationRules as aR, SpeculationRulesScript as aS, StringInnerContent as aT, Stringable as aU, StylesheetLink as aV, TagKey as aW, TagPosition as aX, TagPriority as aY, TagUserProperties as aZ, TemplateParams as a_, MetaProperties as aa, ModuleScript as ab, ModulepreloadLink as ac, NameMeta as ad, Never as ae, NextLink as af, PingbackLink as ag, PreconnectLink as ah, PrefetchLink as ai, PreloadFontLink as aj, PreloadImageLink as ak, PreloadLink as al, PreloadLinkBase as am, PreloadOtherLink as an, PreloadScriptLink as ao, PreloadStyleLink as ap, PrerenderLink as aq, PrevLink as ar, PrivacyPolicyLink as as, ProcessesTemplateParams as at, PropertyMeta as au, RawInput as av, ResolvableBase as aw, ResolvableBodyAttributes as ax, ResolvableHtmlAttributes as ay, ResolvableLink as az, AlternateLink as b, TermsOfServiceLink as b0, UnheadBodyAttributesWithoutEvents as b1, UnheadHtmlAttributes as b2, UnheadMeta as b3, UseHeadInput as b4, UseSeoMetaInput as b5, ValidTagPositions as b6, WebmentionLink as b7, AlternateMediaLink as c, AlternateStylesheetLink as d, AmpHtmlLink as e, AppleTouchIconLink as f, AppleTouchStartupImageLink as g, ApplicationJsonScript as h, Arrayable as i, AuthorLink as j, BareAlternateLink as k, BodyAttributesWithoutEvents as l, BodyEvents as m, CharsetMeta as n, CompressionDictionaryLink as o, DeepReadonly as p, DeepResolvableProperties as q, DnsPrefetchLink as r, ExternalScript as s, GenericScript as t, GlobalAttributes as u, HeadTag as v, HeadTagKeys as w, HelpLink as x, HttpEquivMeta as y, HttpEventAttributes as z };
|
|
@@ -1095,7 +1095,7 @@ type MetaNames = 'apple-itunes-app' | 'apple-mobile-web-app-capable' | 'apple-mo
|
|
|
1095
1095
|
/**
|
|
1096
1096
|
* Known meta property values (OpenGraph, etc.)
|
|
1097
1097
|
*/
|
|
1098
|
-
type MetaProperties = 'article:author' | 'article:expiration_time' | 'article:modified_time' | 'article:published_time' | 'article:section' | 'article:tag' | 'book:author' | 'book:isbn' | 'book:release_date' | 'book:tag' | 'fb:app:id' | 'og:audio:secure_url' | 'og:audio:type' | 'og:audio:url' | 'og:description' | 'og:determiner' | 'og:image:height' | 'og:image:secure_url' | 'og:image:type' | 'og:image:url' | 'og:image:width' | 'og:image' | 'og:locale:alternate' | 'og:locale' | 'og:site:name' | 'og:title' | 'og:type' | 'og:url' | 'og:video:height' | 'og:video:secure_url' | 'og:video:type' | 'og:video:url' | 'og:video:width' | 'og:video' | 'profile:first_name' | 'profile:gender' | 'profile:last_name' | 'profile:username';
|
|
1098
|
+
type MetaProperties = 'article:author' | 'article:expiration_time' | 'article:modified_time' | 'article:published_time' | 'article:section' | 'article:tag' | 'book:author' | 'book:isbn' | 'book:release_date' | 'book:tag' | 'fb:app:id' | 'og:audio:secure_url' | 'og:audio:type' | 'og:audio:url' | 'og:description' | 'og:determiner' | 'og:image:height' | 'og:image:secure_url' | 'og:image:type' | 'og:image:url' | 'og:image:width' | 'og:image' | 'og:locale:alternate' | 'og:locale' | 'og:site:name' | 'og:title' | 'og:type' | 'og:url' | 'og:video:height' | 'og:video:secure_url' | 'og:video:type' | 'og:video:url' | 'og:video:width' | 'og:video' | 'payment:amount' | 'payment:currency' | 'payment:description' | 'payment:expires_at' | 'payment:id' | 'payment:status' | 'payment:success_url' | 'profile:first_name' | 'profile:gender' | 'profile:last_name' | 'profile:username';
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Base properties shared by all meta types
|
|
1101
1101
|
*/
|
|
@@ -1266,7 +1266,54 @@ interface MetaFlatProfile {
|
|
|
1266
1266
|
*/
|
|
1267
1267
|
profileUsername?: string;
|
|
1268
1268
|
}
|
|
1269
|
-
interface
|
|
1269
|
+
interface MetaFlatPayment {
|
|
1270
|
+
/**
|
|
1271
|
+
* Description about the payment link.
|
|
1272
|
+
*
|
|
1273
|
+
* @see https://ogp.me/ns/payment#
|
|
1274
|
+
*/
|
|
1275
|
+
paymentDescription?: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* The currency code ISO 4217 of the payment.
|
|
1278
|
+
* @example 'USD'
|
|
1279
|
+
*
|
|
1280
|
+
* @see https://ogp.me/ns/payment#
|
|
1281
|
+
*/
|
|
1282
|
+
paymentCurrency?: string;
|
|
1283
|
+
/**
|
|
1284
|
+
* An amount requested on the payment link in decimal format.
|
|
1285
|
+
* @example 19.99
|
|
1286
|
+
*
|
|
1287
|
+
* @see https://ogp.me/ns/payment#
|
|
1288
|
+
*/
|
|
1289
|
+
paymentAmount?: string | number;
|
|
1290
|
+
/**
|
|
1291
|
+
* The date and time including minutes and seconds on which the payment link expires.
|
|
1292
|
+
* @example '1970-01-01T00:00:00.000Z'
|
|
1293
|
+
*
|
|
1294
|
+
* @see https://ogp.me/ns/payment#
|
|
1295
|
+
*/
|
|
1296
|
+
paymentExpiresAt?: string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Status of the payment.
|
|
1299
|
+
*
|
|
1300
|
+
* @see https://ogp.me/ns/payment#
|
|
1301
|
+
*/
|
|
1302
|
+
paymentStatus?: 'PENDING' | 'PAID' | 'FAILED' | 'EXPIRED';
|
|
1303
|
+
/**
|
|
1304
|
+
* The unique identifier associated with the payment link for a given payment gateway or service provider.
|
|
1305
|
+
*
|
|
1306
|
+
* @see https://ogp.me/ns/payment#
|
|
1307
|
+
*/
|
|
1308
|
+
paymentId?: string;
|
|
1309
|
+
/**
|
|
1310
|
+
* A valid URL that gets redirected when payment is success.
|
|
1311
|
+
*
|
|
1312
|
+
* @see https://ogp.me/ns/payment#
|
|
1313
|
+
*/
|
|
1314
|
+
paymentSuccessUrl?: string;
|
|
1315
|
+
}
|
|
1316
|
+
interface MetaFlat extends MetaFlatArticle, MetaFlatBook, MetaFlatProfile, MetaFlatPayment {
|
|
1270
1317
|
/**
|
|
1271
1318
|
* This attribute declares the document's character encoding.
|
|
1272
1319
|
* If the attribute is present, its value must be an ASCII case-insensitive match for the string "utf-8",
|
|
@@ -1551,7 +1598,7 @@ interface MetaFlat extends MetaFlatArticle, MetaFlatBook, MetaFlatProfile {
|
|
|
1551
1598
|
*
|
|
1552
1599
|
* @see https://ogp.me/#metadata
|
|
1553
1600
|
*/
|
|
1554
|
-
ogType?: 'website' | 'article' | 'book' | 'profile' | 'music.song' | 'music.album' | 'music.playlist' | 'music.
|
|
1601
|
+
ogType?: 'website' | 'article' | 'book' | 'profile' | 'music.song' | 'music.album' | 'music.playlist' | 'music.radio_station' | 'video.movie' | 'video.episode' | 'video.tv_show' | 'video.other' | 'payment.link';
|
|
1555
1602
|
/**
|
|
1556
1603
|
* The locale of the resource. Defaults to en_US.
|
|
1557
1604
|
*
|
|
@@ -2976,4 +3023,4 @@ interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTempl
|
|
|
2976
3023
|
}
|
|
2977
3024
|
type HeadTagKeys = (keyof HeadTag)[];
|
|
2978
3025
|
|
|
2979
|
-
export type {
|
|
3026
|
+
export type { LinkHttpEvents 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, HubLink as I, IconLink as J, ImportMapConfig as K, ImportMapScript as L, InferLink as M, InferScript as N, InlineModuleScript as O, InlineScript as P, InnerContent as Q, ResolvableHead as R, SerializableHead as S, InnerContentVal as T, InternalTagKey as U, JsonLdScript as V, KnownLinkRel as W, KnownScriptType as X, LicenseLink as Y, Link as Z, LinkBase as _, AlternateLanguageLink as a, TemplateParamsAugmentations as a$, ManifestLink as a0, MaskIconLink as a1, MaybeArray as a2, MaybeEventFnHandlers as a3, MeLink as a4, Meta as a5, MetaBase as a6, MetaFlat as a7, MetaGeneric as a8, MetaNames as a9, ResolvableMeta as aA, ResolvableNoscript as aB, ResolvableProperties as aC, ResolvableScript as aD, ResolvableStyle as aE, ResolvableTemplateParams as aF, ResolvableTitle as aG, ResolvableTitleTemplate as aH, ResolvableUnion as aI, ResolvableValue as aJ, ResolvesDuplicates as aK, SchemaAugmentations as aL, Script as aM, ScriptBase as aN, ScriptHttpEvents as aO, SearchLink as aP, SitemapLink as aQ, SpeculationRules as aR, SpeculationRulesScript as aS, StringInnerContent as aT, Stringable as aU, StylesheetLink as aV, TagKey as aW, TagPosition as aX, TagPriority as aY, TagUserProperties as aZ, TemplateParams as a_, MetaProperties as aa, ModuleScript as ab, ModulepreloadLink as ac, NameMeta as ad, Never as ae, NextLink as af, PingbackLink as ag, PreconnectLink as ah, PrefetchLink as ai, PreloadFontLink as aj, PreloadImageLink as ak, PreloadLink as al, PreloadLinkBase as am, PreloadOtherLink as an, PreloadScriptLink as ao, PreloadStyleLink as ap, PrerenderLink as aq, PrevLink as ar, PrivacyPolicyLink as as, ProcessesTemplateParams as at, PropertyMeta as au, RawInput as av, ResolvableBase as aw, ResolvableBodyAttributes as ax, ResolvableHtmlAttributes as ay, ResolvableLink as az, AlternateLink as b, TermsOfServiceLink as b0, UnheadBodyAttributesWithoutEvents as b1, UnheadHtmlAttributes as b2, UnheadMeta as b3, UseHeadInput as b4, UseSeoMetaInput as b5, ValidTagPositions as b6, WebmentionLink as b7, AlternateMediaLink as c, AlternateStylesheetLink as d, AmpHtmlLink as e, AppleTouchIconLink as f, AppleTouchStartupImageLink as g, ApplicationJsonScript as h, Arrayable as i, AuthorLink as j, BareAlternateLink as k, BodyAttributesWithoutEvents as l, BodyEvents as m, CharsetMeta as n, CompressionDictionaryLink as o, DeepReadonly as p, DeepResolvableProperties as q, DnsPrefetchLink as r, ExternalScript as s, GenericScript as t, GlobalAttributes as u, HeadTag as v, HeadTagKeys as w, HelpLink as x, HttpEquivMeta as y, HttpEventAttributes as z };
|
|
@@ -34,5 +34,5 @@ type RulesConfig = {
|
|
|
34
34
|
[K in ValidationRuleId]?: RuleConfig<K>;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export { VALIDATION_RULE_IDS as
|
|
38
|
-
export type {
|
|
37
|
+
export { VALIDATION_RULE_IDS as d };
|
|
38
|
+
export type { RulesConfig as R, ValidationRuleId as V, RuleConfig as a, RuleSeverity as b, ValidationRuleOptions as c };
|
|
@@ -34,5 +34,5 @@ type RulesConfig = {
|
|
|
34
34
|
[K in ValidationRuleId]?: RuleConfig<K>;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export { VALIDATION_RULE_IDS as
|
|
38
|
-
export type {
|
|
37
|
+
export { VALIDATION_RULE_IDS as d };
|
|
38
|
+
export type { RulesConfig as R, ValidationRuleId as V, RuleConfig as a, RuleSeverity as b, ValidationRuleOptions as c };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { av as RawInput, R as ResolvableHead, aJ as ResolvableValue, aC as ResolvableProperties, G as GenericLink, D as DataKeys, aL as SchemaAugmentations, a8 as MetaGeneric, t as GenericScript, b2 as UnheadHtmlAttributes, b1 as UnheadBodyAttributesWithoutEvents } from './unhead.Dl7UHSN0.js';
|
|
2
2
|
|
|
3
3
|
type Base = RawInput<'base'>;
|
|
4
4
|
type HtmlAttributes = RawInput<'htmlAttrs'>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { U as UniqueTags, c as TagsWithInnerContent, M as MetaTagsArrayable, H as HasElementTags, T as TagConfigKeys, D as DupeableTags, d as UsesMergeStrategy, V as ValidHeadTags } from './unhead.fg-0ge_u.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { a as callHook } from './unhead.DvIxXxuO.mjs';
|
|
3
3
|
|
|
4
4
|
const META_NOREWRITE_RE = /^(?:viewport|description|keywords|robots)$/;
|
|
5
|
+
const META_KEY_ATTRS = ["name", "property", "http-equiv"];
|
|
5
6
|
function isMetaArrayDupeKey(v) {
|
|
6
7
|
return MetaTagsArrayable.has(v.split(":")[1]);
|
|
7
8
|
}
|
|
@@ -20,7 +21,7 @@ function dedupeKey(tag) {
|
|
|
20
21
|
if (props.charset)
|
|
21
22
|
return "charset";
|
|
22
23
|
if (t === "meta") {
|
|
23
|
-
for (const n of
|
|
24
|
+
for (const n of META_KEY_ATTRS) {
|
|
24
25
|
const v = props[n];
|
|
25
26
|
if (v !== void 0)
|
|
26
27
|
return `meta:${v}${(typeof v !== "string" || !v.includes(":")) && !META_NOREWRITE_RE.test(v) && key ? `:key:${key}` : ""}`;
|
|
@@ -136,12 +137,16 @@ function normalizeEntryToTags(input, propResolvers) {
|
|
|
136
137
|
return [];
|
|
137
138
|
if (typeof input === "function")
|
|
138
139
|
input = input();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
let resolve;
|
|
141
|
+
if (propResolvers.length) {
|
|
142
|
+
resolve = (key, val) => {
|
|
143
|
+
for (let i = 0; i < propResolvers.length; i++)
|
|
144
|
+
val = propResolvers[i](key, val);
|
|
145
|
+
return val;
|
|
146
|
+
};
|
|
147
|
+
input = resolve(void 0, input);
|
|
148
|
+
}
|
|
149
|
+
input = walkResolver(input, resolve);
|
|
145
150
|
const tags = [];
|
|
146
151
|
for (const key in input) {
|
|
147
152
|
const value = input[key];
|
|
@@ -155,6 +160,8 @@ function normalizeEntryToTags(input, propResolvers) {
|
|
|
155
160
|
const LT_RE = /</g;
|
|
156
161
|
const SCRIPT_END_RE = /<\/script/g;
|
|
157
162
|
const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w;
|
|
163
|
+
const DEFAULT_TAG_WEIGHT = () => 100;
|
|
164
|
+
const TAG_MUTATING_HOOK_RE = /^tags:|:render/;
|
|
158
165
|
function dedupeTags(ctx) {
|
|
159
166
|
let hasFlatMeta = false;
|
|
160
167
|
for (const next of ctx.tags.sort(sortTags)) {
|
|
@@ -200,28 +207,32 @@ function resolveTitleTemplate(ctx, head) {
|
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
function sanitizeTags(tags) {
|
|
203
|
-
|
|
210
|
+
const out = [];
|
|
211
|
+
for (let t of tags) {
|
|
204
212
|
const { innerHTML, tag, props } = t;
|
|
205
213
|
if (!ValidHeadTags.has(tag) || !Object.keys(props).length && !innerHTML && !t.textContent)
|
|
206
|
-
|
|
214
|
+
continue;
|
|
207
215
|
if (tag === "meta" && !props.content && !props["http-equiv"] && !props.charset)
|
|
208
|
-
|
|
216
|
+
continue;
|
|
209
217
|
if (tag === "script" && (innerHTML || t.textContent)) {
|
|
210
218
|
const type = String(props.type);
|
|
211
219
|
const isJsonLike = type.endsWith("json") || type === "importmap" || type === "speculationrules";
|
|
212
220
|
const escape = (content) => isJsonLike ? (typeof content === "string" ? content : JSON.stringify(content)).replace(LT_RE, "\\u003C") : typeof content === "string" ? content.replace(SCRIPT_END_RE, "<\\/script") : content;
|
|
221
|
+
t = { ...t };
|
|
213
222
|
if (innerHTML)
|
|
214
223
|
t.innerHTML = escape(innerHTML);
|
|
215
224
|
if (t.textContent)
|
|
216
225
|
t.textContent = escape(t.textContent);
|
|
217
226
|
t._d = dedupeKey(t);
|
|
218
227
|
}
|
|
219
|
-
|
|
220
|
-
}
|
|
228
|
+
out.push(t);
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
221
231
|
}
|
|
222
232
|
function resolveTags(head, options) {
|
|
223
|
-
const weightFn = options?.tagWeight ?? head.resolvedOptions._tagWeight ??
|
|
233
|
+
const weightFn = options?.tagWeight ?? head.resolvedOptions._tagWeight ?? DEFAULT_TAG_WEIGHT;
|
|
224
234
|
const ctx = { tagMap: /* @__PURE__ */ new Map(), tags: [] };
|
|
235
|
+
const hooks = head.hooks?._hooks || {};
|
|
225
236
|
const entries = [...head.entries.values()];
|
|
226
237
|
for (const e of entries) {
|
|
227
238
|
if (e._pending !== void 0) {
|
|
@@ -248,7 +259,21 @@ function resolveTags(head, options) {
|
|
|
248
259
|
});
|
|
249
260
|
}
|
|
250
261
|
}
|
|
251
|
-
|
|
262
|
+
let needsClone = false;
|
|
263
|
+
for (const k in hooks) {
|
|
264
|
+
if (TAG_MUTATING_HOOK_RE.test(k) && hooks[k]?.some((f) => !f._nonMutating)) {
|
|
265
|
+
needsClone = true;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
ctx.tags = needsClone ? entries.flatMap((e) => (e._tags || []).map((t) => {
|
|
270
|
+
const props = { ...t.props };
|
|
271
|
+
if (props.class instanceof Set)
|
|
272
|
+
props.class = new Set(props.class);
|
|
273
|
+
if (props.style instanceof Map)
|
|
274
|
+
props.style = new Map(props.style);
|
|
275
|
+
return { ...t, props };
|
|
276
|
+
})) : entries.flatMap((e) => e._tags || []);
|
|
252
277
|
const hasFlatMeta = dedupeTags(ctx);
|
|
253
278
|
resolveTitleTemplate(ctx, head);
|
|
254
279
|
ctx.tags = [...ctx.tagMap.values()];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as callHook } from './unhead.DvIxXxuO.mjs';
|
|
2
2
|
import { S as ScriptNetworkEvents } from './unhead.fg-0ge_u.mjs';
|
|
3
3
|
|
|
4
4
|
function createNoopedRecordingProxy(instance = {}) {
|
|
@@ -111,7 +111,7 @@ function useScript(head, _input, _options) {
|
|
|
111
111
|
const loadPromise = new Promise((resolve) => {
|
|
112
112
|
if (head.ssr)
|
|
113
113
|
return;
|
|
114
|
-
const emit = (api) =>
|
|
114
|
+
const emit = (api) => queueMicrotask(() => resolve(api));
|
|
115
115
|
const unhook = head.hooks?.hook("script:updated", ({ script: script2 }) => {
|
|
116
116
|
const status = script2.status;
|
|
117
117
|
if (script2.id === id && (status === "loaded" || status === "error")) {
|
|
@@ -12,7 +12,8 @@ const URL_META_KEYS = /* @__PURE__ */ new Set([
|
|
|
12
12
|
"twitter:image",
|
|
13
13
|
"twitter:image:src",
|
|
14
14
|
"twitter:player",
|
|
15
|
-
"twitter:player:stream"
|
|
15
|
+
"twitter:player:stream",
|
|
16
|
+
"payment:success_url"
|
|
16
17
|
]);
|
|
17
18
|
const KNOWN_META_PROPERTIES = /* @__PURE__ */ new Set([
|
|
18
19
|
"article:author",
|
|
@@ -53,6 +54,13 @@ const KNOWN_META_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
53
54
|
"og:video:type",
|
|
54
55
|
"og:video:url",
|
|
55
56
|
"og:video:width",
|
|
57
|
+
"payment:amount",
|
|
58
|
+
"payment:currency",
|
|
59
|
+
"payment:description",
|
|
60
|
+
"payment:expires_at",
|
|
61
|
+
"payment:id",
|
|
62
|
+
"payment:status",
|
|
63
|
+
"payment:success_url",
|
|
56
64
|
"profile:first_name",
|
|
57
65
|
"profile:gender",
|
|
58
66
|
"profile:last_name",
|
|
@@ -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.CBj56GgY.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Load third-party scripts with SSR support and a proxied API.
|
package/dist/stream/client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ClientUnhead } from '../shared/unhead.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as ClientUnhead } from '../shared/unhead.CRVUlr67.mjs';
|
|
2
|
+
import { U as Unhead, C as CreateClientHeadOptions } from '../shared/unhead.CS8tFxG3.mjs';
|
|
3
|
+
import { S as SerializableHead, R as ResolvableHead } from '../shared/unhead.Dl7UHSN0.mjs';
|
|
4
4
|
import 'hookable';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/stream/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ClientUnhead } from '../shared/unhead.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { C as ClientUnhead } from '../shared/unhead.BWKj-eGY.js';
|
|
2
|
+
import { U as Unhead, C as CreateClientHeadOptions } from '../shared/unhead.CBj56GgY.js';
|
|
3
|
+
import { S as SerializableHead, R as ResolvableHead } from '../shared/unhead.Dl7UHSN0.js';
|
|
4
4
|
import 'hookable';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/stream/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerPlugin } from '../shared/unhead.CfgPMHXt.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { c as createHooks } from '../shared/unhead.DvIxXxuO.mjs';
|
|
3
3
|
import 'hookable';
|
|
4
4
|
|
|
5
5
|
const DEFAULT_STREAM_KEY = "__unhead__";
|