This commit is contained in:
2025-07-26 21:54:04 +03:30
parent f720424180
commit 615dc6a033
682 changed files with 6709 additions and 15232 deletions
@@ -1,5 +1,5 @@
import { createHooks } from 'hookable';
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.Di5OD67x.mjs';
import { n as normalizeEntryToTags, d as dedupeKey, i as isMetaArrayDupeKey } from './unhead.ytfIU1HR.mjs';
import { t as tagWeight, s as sortTags } from './unhead.DZbvapt-.mjs';
import { c as UsesMergeStrategy, V as ValidHeadTags } from './unhead.yem5I2v_.mjs';
@@ -23,7 +23,7 @@ function createUnhead(resolvedOptions = {}) {
const ssr = !resolvedOptions.document;
const entries = /* @__PURE__ */ new Map();
const plugins = /* @__PURE__ */ new Map();
const normalizeQueue = /* @__PURE__ */ new Set();
const normalizeQueue = [];
const head = {
_entryCount: 1,
// 0 is reserved for internal use
@@ -45,12 +45,12 @@ function createUnhead(resolvedOptions = {}) {
const _ = {
_poll(rm = false) {
head.dirty = true;
!rm && normalizeQueue.add(_i);
!rm && normalizeQueue.push(_i);
hooks.callHook("entries:updated", head);
},
dispose() {
if (entries.delete(_i)) {
head.invalidate();
_._poll(true);
}
},
// a patch is the same as creating a new entry, just a nice DX
@@ -72,9 +72,8 @@ function createUnhead(resolvedOptions = {}) {
entries: [...head.entries.values()]
};
await hooks.callHook("entries:resolve", ctx);
while (normalizeQueue.size) {
const i = normalizeQueue.values().next().value;
normalizeQueue.delete(i);
while (normalizeQueue.length) {
const i = normalizeQueue.shift();
const e = entries.get(i);
if (e) {
const normalizeCtx = {
@@ -162,13 +161,6 @@ function createUnhead(resolvedOptions = {}) {
finalTags.push(t);
}
return finalTags;
},
invalidate() {
for (const entry of entries.values()) {
normalizeQueue.add(entry._i);
}
head.dirty = true;
hooks.callHook("entries:updated", head);
}
};
(resolvedOptions?.plugins || []).forEach((p) => registerPlugin(head, p));
@@ -1,12 +1,6 @@
import { U as UniqueTags, T as TagsWithInnerContent, M as MetaTagsArrayable, a as TagConfigKeys, D as DupeableTags } from './unhead.yem5I2v_.mjs';
const allowedMetaProperties = ["name", "property", "http-equiv"];
const StandardSingleMetaTags = /* @__PURE__ */ new Set([
"viewport",
"description",
"keywords",
"robots"
]);
function isMetaArrayDupeKey(v) {
const parts = v.split(":");
if (!parts.length)
@@ -24,12 +18,7 @@ function dedupeKey(tag) {
if (tag.tag === "meta") {
for (const n of allowedMetaProperties) {
if (props[n] !== void 0) {
const propValue = props[n];
const isStructured = propValue.includes(":");
const isStandardSingle = StandardSingleMetaTags.has(propValue);
const shouldAlwaysDedupe = isStructured || isStandardSingle;
const keyPart = !shouldAlwaysDedupe && tag.key ? `:key:${tag.key}` : "";
return `${name}:${propValue}${keyPart}`;
return `${name}:${props[n]}`;
}
}
}