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.
Files changed (45) hide show
  1. package/dist/client.d.mts +5 -5
  2. package/dist/client.d.ts +5 -5
  3. package/dist/client.mjs +2 -2
  4. package/dist/index.d.mts +54 -5
  5. package/dist/index.d.ts +54 -5
  6. package/dist/index.mjs +8 -1
  7. package/dist/parser.d.mts +1 -1
  8. package/dist/parser.d.ts +1 -1
  9. package/dist/plugins.d.mts +2 -2
  10. package/dist/plugins.d.ts +2 -2
  11. package/dist/scripts.d.mts +4 -4
  12. package/dist/scripts.d.ts +4 -4
  13. package/dist/server.d.mts +4 -4
  14. package/dist/server.d.ts +4 -4
  15. package/dist/server.mjs +3 -3
  16. package/dist/shared/{unhead.Dyr7L2Ht.d.mts → unhead.5pUZeb0i.d.mts} +154 -26
  17. package/dist/shared/{unhead.Dyr7L2Ht.d.ts → unhead.5pUZeb0i.d.ts} +154 -26
  18. package/dist/shared/{unhead.DbDvRsnF.d.mts → unhead.BAv4ddL5.d.mts} +1 -1
  19. package/dist/shared/{unhead.DmIUoNyg.d.ts → unhead.BEof8Qjb.d.ts} +1 -1
  20. package/dist/shared/{unhead.cnX_MFeG.d.ts → unhead.BRPfhzdc.d.ts} +2 -2
  21. package/dist/shared/{unhead.Db0zAB-x.d.mts → unhead.BxsOjg-Q.d.mts} +2 -2
  22. package/dist/shared/{unhead.Sr8_Iw6G.mjs → unhead.C5ypJnIO.mjs} +8 -4
  23. package/dist/shared/{unhead.BiaRAmcT.d.mts → unhead.CUEmFl2d.d.mts} +1 -1
  24. package/dist/shared/{unhead.D6A03PN3.d.mts → unhead.CyKsApKH.d.mts} +1 -1
  25. package/dist/shared/{unhead.DFKqTFly.d.ts → unhead.D_sLwV5L.d.ts} +2 -2
  26. package/dist/shared/{unhead.DQiBmCqH.mjs → unhead.DiRbsb3I.mjs} +9 -3
  27. package/dist/shared/{unhead.B825tVHL.d.mts → unhead.DvMT2vYs.d.mts} +2 -2
  28. package/dist/shared/{unhead.DvZZ4Zb_.d.ts → unhead.JGBJYEOZ.d.ts} +1 -1
  29. package/dist/shared/{unhead.DKz0V2If.d.ts → unhead.UFdAtJOd.d.ts} +1 -1
  30. package/dist/shared/{unhead.DyN7hSCT.d.mts → unhead.dhQT0IKI.d.mts} +1 -1
  31. package/dist/shared/{unhead.D4TxP3zZ.mjs → unhead.pv34ME7O.mjs} +1 -1
  32. package/dist/shared/{unhead.Cp3HtzBy.d.ts → unhead.vQPF0cJs.d.ts} +1 -1
  33. package/dist/stream/client.d.mts +3 -3
  34. package/dist/stream/client.d.ts +3 -3
  35. package/dist/stream/iife.global.js +1 -1
  36. package/dist/stream/iife.mjs +2 -2
  37. package/dist/stream/server.d.mts +3 -3
  38. package/dist/stream/server.d.ts +3 -3
  39. package/dist/stream/server.mjs +16 -3
  40. package/dist/types.d.mts +6 -6
  41. package/dist/types.d.ts +6 -6
  42. package/dist/utils.d.mts +2 -2
  43. package/dist/utils.d.ts +2 -2
  44. package/dist/utils.mjs +1 -1
  45. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- export const streamingIifeCode = "var __unhead_iife__ = (function (exports) { 'use strict'; const DupeableTags = new Set([\"link\", \"style\", \"script\", \"noscript\"]); const TagsWithInnerContent = new Set([\"title\", \"titleTemplate\", \"script\", \"style\", \"noscript\"]); const HasElementTags = new Set([\"base\", \"meta\", \"link\", \"style\", \"script\", \"noscript\"]); const ValidHeadTags = new Set([\"title\", \"base\", \"htmlAttrs\", \"bodyAttrs\", \"meta\", \"link\", \"style\", \"script\", \"noscript\"]); const UniqueTags = new Set([\"base\", \"title\", \"titleTemplate\", \"bodyAttrs\", \"htmlAttrs\", \"templateParams\"]); const TagConfigKeys = new Set([\"key\", \"tagPosition\", \"tagPriority\", \"tagDuplicateStrategy\", \"innerHTML\", \"textContent\", \"processTemplateParams\"]); const UsesMergeStrategy = new Set([\"templateParams\", \"htmlAttrs\", \"bodyAttrs\"]); const MetaTagsArrayable = new Set([ \"theme-color\", \"google-site-verification\", \"og\", \"article\", \"book\", \"profile\", \"twitter\", \"author\" ]); function callHook(head, hook, ctx) { return head.hooks?.callHook(hook, ctx); } const META_NOREWRITE_RE = /^(?:viewport|description|keywords|robots)$/; function isMetaArrayDupeKey(v) { return MetaTagsArrayable.has(v.split(\":\")[1]); } function dedupeKey(tag) { const { props, tag: t, key } = tag; if (UniqueTags.has(t)) return t; if (t === \"link\" && props.rel === \"canonical\") return \"canonical\"; if (t === \"link\" && props.rel === \"alternate\") { const altKey = props.hreflang || props.type; if (altKey) return `alternate:${altKey}`; } if (props.charset) return \"charset\"; if (t === \"meta\") { for (const n of [\"name\", \"property\", \"http-equiv\"]) { const v = props[n]; if (v !== void 0) return `meta:${v}${(typeof v !== \"string\" || !v.includes(\":\")) && !META_NOREWRITE_RE.test(v) && key ? `:key:${key}` : \"\"}`; } } if (key) return `${t}:key:${key}`; if (props.id) return `${t}:id:${props.id}`; if (t === \"link\" && props.rel === \"alternate\") return `alternate:${props.href || \"\"}`; return TagsWithInnerContent.has(t) && (tag.textContent || tag.innerHTML) ? `${t}:content:${tag.textContent || tag.innerHTML}` : void 0; } function hashTag(tag) { return tag._h || tag._d || tag.textContent || tag.innerHTML || `${tag.tag}:${Object.entries(tag.props).map(([k, v]) => `${k}:${String(v)}`).join()}`; } function walkResolver(val, resolve, key) { if (key === \"_resolver\") return val; if (typeof val === \"function\" && (!key || key !== \"titleTemplate\" && !key.startsWith(\"on\"))) val = val(); const v = resolve ? resolve(key, val) : val; if (Array.isArray(v)) return v.map((r) => walkResolver(r, resolve)); if (v?.constructor === Object) { const next = {}; for (const k in v) { if (k === \"__proto__\" || k === \"constructor\" || k === \"prototype\") continue; next[k] = walkResolver(v[k], resolve, k); } return next; } return v; } function normalizeStyleClassProps(key, value) { const isStyle = key === \"style\"; const store = isStyle ? new Map() : new Set(); const add = (v) => { if (!v) return; if (isStyle) { const i = v.indexOf(\":\"); i > 0 && store.set(v.slice(0, i).trim(), v.slice(i + 1).trim()); } else { v.split(\" \").forEach((c) => c && store.add(c)); } }; if (typeof value === \"string\") { (isStyle ? value.split(\";\") : [value]).forEach(add); } else if (Array.isArray(value)) { value.forEach(add); } else if (value && typeof value === \"object\") { for (const k in value) { const v = value[k]; v && v !== \"false\" && (isStyle ? store.set(k.trim(), String(v)) : add(k)); } } return store; } function normalizeProps(tag, input) { tag.props = tag.props || {}; if (!input) return tag; if (tag.tag === \"templateParams\") { tag.props = input; return tag; } const isHtmlTag = HasElementTags.has(tag.tag) || tag.tag === \"htmlAttrs\" || tag.tag === \"bodyAttrs\"; for (const prop in input) { if (prop === \"__proto__\" || prop === \"constructor\" || prop === \"prototype\") continue; const value = input[prop]; if (value === null) { tag.props[prop] = null; } else if (prop === \"class\" || prop === \"style\") { tag.props[prop] = normalizeStyleClassProps(prop, value); } else if (TagConfigKeys.has(prop)) { if ((prop === \"textContent\" || prop === \"innerHTML\") && typeof value === \"object\") { const type = input.type || \"application/json\"; if (type.endsWith(\"json\") || type === \"speculationrules\") { tag.props.type = input.type = type; tag[prop] = JSON.stringify(value); } } else { tag[prop] = value; } } else if (value !== void 0) { const isData = prop.startsWith(\"data-\"); const key = isHtmlTag && !isData ? prop.toLowerCase() : prop; const str = String(value); const isMeta = tag.tag === \"meta\" && key === \"content\"; tag.props[key] = str === \"true\" || str === \"\" ? isData || isMeta ? str : true : !value && isData && str === \"false\" ? \"false\" : value; } } return tag; } function normalizeTag(tagName, _input) { const input = typeof _input === \"object\" && typeof _input !== \"function\" ? _input : { [tagName === \"script\" || tagName === \"noscript\" || tagName === \"style\" ? \"innerHTML\" : \"textContent\"]: _input }; const tag = normalizeProps({ tag: tagName, props: {} }, input); if (tag.key && DupeableTags.has(tag.tag)) tag.props[\"data-hid\"] = tag._h = tag.key; if (tag.tag === \"script\" && typeof tag.innerHTML === \"object\") { tag.innerHTML = JSON.stringify(tag.innerHTML); tag.props.type = tag.props.type || \"application/json\"; } return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag; } function normalizeEntryToTags(input, propResolvers) { if (!input) return []; if (typeof input === \"function\") input = input(); const resolvers = (key, val) => { for (const r of propResolvers) val = r(key, val); return val; }; input = walkResolver(resolvers(void 0, input), resolvers); const tags = []; for (const key in input) { const value = input[key]; if (value !== void 0) { for (const v of Array.isArray(value) ? value : [value]) tags.push(normalizeTag(key, v)); } } return tags.flat(); } const LT_RE = /</g; const SCRIPT_END_RE = /<\\/script/g; const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w; function dedupeTags(ctx) { let hasFlatMeta = false; for (const next of ctx.tags.sort(sortTags)) { const k = next._d || hashTag(next); const prev = ctx.tagMap.get(k); if (!prev) { ctx.tagMap.set(k, next); continue; } const strategy = next.tagDuplicateStrategy || (UsesMergeStrategy.has(next.tag) ? \"merge\" : null) || (next.key && next.key === prev.key ? \"merge\" : null); if (strategy === \"merge\") { const props = { ...prev.props }; for (const p in next.props) { props[p] = p === \"style\" ? new Map([...prev.props.style || new Map(), ...next.props[p]]) : p === \"class\" ? new Set([...prev.props.class || [], ...next.props[p]]) : next.props[p]; } ctx.tagMap.set(k, { ...next, props }); } else if (next._p >> 10 === prev._p >> 10 && next.tag === \"meta\" && isMetaArrayDupeKey(k)) { ctx.tagMap.set(k, Object.assign([...Array.isArray(prev) ? prev : [prev], next], next)); hasFlatMeta = true; } else if (next._w === prev._w ? next._p > prev._p : next._w < prev._w) { ctx.tagMap.set(k, next); } } return hasFlatMeta; } function resolveTitleTemplate(ctx, head) { const title = ctx.tagMap.get(\"title\"); const tpl = ctx.tagMap.get(\"titleTemplate\"); head._title = title?.textContent; if (!tpl) return; const fn = tpl.textContent; head._titleTemplate = fn; if (!fn) return; let v = typeof fn === \"function\" ? fn(title?.textContent) : fn; if (typeof v === \"string\" && !head.plugins.has(\"template-params\")) v = v.replace(\"%s\", title?.textContent || \"\"); if (title) { v === null ? ctx.tagMap.delete(\"title\") : ctx.tagMap.set(\"title\", { ...title, textContent: v }); } else { ctx.tagMap.set(\"titleTemplate\", { ...tpl, tag: \"title\", textContent: v }); } } function sanitizeTags(tags) { return tags.filter((t) => { const { innerHTML, tag, props } = t; if (!ValidHeadTags.has(tag) || !Object.keys(props).length && !innerHTML && !t.textContent) return false; if (tag === \"meta\" && !props.content && !props[\"http-equiv\"] && !props.charset) return false; if (tag === \"script\" && innerHTML) { t.innerHTML = String(props.type).endsWith(\"json\") ? (typeof innerHTML === \"string\" ? innerHTML : JSON.stringify(innerHTML)).replace(LT_RE, \"\\\\u003C\") : typeof innerHTML === \"string\" ? innerHTML.replace(SCRIPT_END_RE, \"<\\\\/script\") : innerHTML; t._d = dedupeKey(t); } return true; }); } function resolveTags(head, options) { const weightFn = options?.tagWeight ?? head.resolvedOptions._tagWeight ?? (() => 100); const ctx = { tagMap: new Map(), tags: [] }; const entries = [...head.entries.values()]; for (const e of entries) { if (e._pending !== void 0) { e.input = e._pending; delete e._pending; delete e._tags; } } callHook(head, \"entries:resolve\", { entries, ...ctx }); for (const e of entries) { if (!e._tags) { const normalizeCtx = { tags: normalizeEntryToTags(e.input, head.resolvedOptions.propResolvers || []).map((t) => Object.assign(t, e.options)), entry: e }; callHook(head, \"entries:normalize\", normalizeCtx); e._tags = normalizeCtx.tags.map((t, i) => { t._w = weightFn(t); t._p = (e._i << 10) + i; t._d = dedupeKey(t); if (!t._d) t._h = hashTag(t); return t; }); } } ctx.tags = entries.flatMap((e) => (e._tags || []).map((t) => ({ ...t, props: { ...t.props } }))); const hasFlatMeta = dedupeTags(ctx); resolveTitleTemplate(ctx, head); ctx.tags = [...ctx.tagMap.values()]; if (hasFlatMeta) ctx.tags = ctx.tags.flat().sort(sortTags); callHook(head, \"tags:beforeResolve\", ctx); callHook(head, \"tags:resolve\", ctx); callHook(head, \"tags:afterResolve\", ctx); return sanitizeTags(ctx.tags); } const WHITESPACE_RE = /\\s+/; function createDomRenderer(options = {}) { return (head) => _renderDOMHead(head, options); } function _renderDOMHead(head, options = {}) { const dom = options.document || head.resolvedOptions.document; if (!dom || !head.dirty && ![...head.entries.values()].some((e) => e._pending !== void 0)) return false; const beforeRenderCtx = { shouldRender: true, tags: [] }; callHook(head, \"dom:beforeRender\", beforeRenderCtx); if (!beforeRenderCtx.shouldRender || head._du) return false; head._du = true; let state = head._dom; if (!state) { state = { _t: dom.title, _e: new Map([[\"htmlAttrs\", dom.documentElement], [\"bodyAttrs\", dom.body]]), _p: {}, _s: {} }; for (const el of [...dom.body.children, ...dom.head.children]) { const tag = el.tagName.toLowerCase(); if (!HasElementTags.has(tag)) continue; const props = { innerHTML: el.innerHTML }; for (const n of el.getAttributeNames()) props[n] = el.getAttribute(n); const next = normalizeProps({ tag, props: {} }, props); next.key = el.getAttribute(\"data-hid\") || void 0; let k = next._d = dedupeKey(next) || hashTag(next); let c = 1; while (state._e.has(k)) k = `${next._d}:${c++}`; state._e.set(k, el); } for (const entry of head.entries.values()) { if (entry._o !== void 0) { const orig = entry._o; for (const t of [\"bodyAttrs\", \"htmlAttrs\"]) { const cls = orig[t]?.class; if (typeof cls === \"string\") { const $el = state._e.get(t); for (const c of cls.split(WHITESPACE_RE)) { if (c) state._p[`${t}:attr:class:${c}`] = () => $el.classList.remove(c); } } } delete entry._o; } } } else { state._p = { ...state._s }; } state._s = {}; function track(id, scope, fn) { const k = `${id}:${scope}`; state._s[k] = fn; delete state._p[k]; } function trackCtx({ id, $el, tag }) { const isAttr = tag.tag.endsWith(\"Attrs\"); state._e.set(id, $el); if (!isAttr) { if (tag.textContent && tag.textContent !== $el.textContent) $el.textContent = tag.textContent; if (tag.innerHTML && tag.innerHTML !== $el.innerHTML) $el.innerHTML = tag.innerHTML; track(id, \"el\", () => { $el?.remove(); state._e.delete(id); }); } for (const k in tag.props) { const v = tag.props[k]; if (k[0] === \"o\" && k[1] === \"n\" && typeof v === \"function\") { const ev = k.slice(2); if ($el?.dataset?.[`${k}fired`]) v.call($el, new Event(ev)); if ($el.getAttribute(`data-${k}`) !== \"\") { (tag.tag === \"bodyAttrs\" ? dom.defaultView : $el).addEventListener(ev, v.bind($el)); $el.setAttribute(`data-${k}`, \"\"); } continue; } const ck = `attr:${k}`; if (k === \"class\" && v) { for (const c of v) { if (isAttr) track(id, `${ck}:${c}`, () => $el.classList.remove(c)); if (!$el.classList.contains(c)) $el.classList.add(c); } } else if (k === \"style\" && v) { for (const [sk, sv] of v) { track(id, `${ck}:${sk}`, () => $el.style.removeProperty(sk)); $el.style.setProperty(sk, sv); } } else if (v !== false && v !== null) { if ($el.getAttribute(k) !== v) $el.setAttribute(k, v === true ? \"\" : String(v)); if (isAttr) track(id, ck, () => $el.removeAttribute(k)); } } } const pending = []; const frag = {}; const rawTags = resolveTags(head, options.tagWeight ? { tagWeight: options.tagWeight } : void 0); const tags = []; const dupeKeyCounter = new Map(); for (const tag of rawTags) { const count = dupeKeyCounter.get(tag._d) || 0; const id = (count ? `${tag._d}:${count}` : tag._d) || tag._h; const ctx = { tag, id, shouldRender: true }; if (tag._d && isMetaArrayDupeKey(tag._d)) dupeKeyCounter.set(tag._d, count + 1); tags.push(ctx); if (tag.tag === \"title\") { dom.title = tag.textContent; track(\"title\", \"\", () => dom.title = state._t); continue; } ctx.$el = state._e.get(id); if (ctx.$el) trackCtx(ctx); else if (HasElementTags.has(tag.tag)) pending.push(ctx); } for (const ctx of pending) { ctx.$el = dom.createElement(ctx.tag.tag); trackCtx(ctx); (frag[ctx.tag.tagPosition || \"head\"] ??= dom.createDocumentFragment()).appendChild(ctx.$el); } if (frag.head) dom.head.appendChild(frag.head); if (frag.bodyOpen) dom.body.insertBefore(frag.bodyOpen, dom.body.firstChild); if (frag.bodyClose) dom.body.appendChild(frag.bodyClose); for (const k in state._p) state._p[k](); head._dom = state; callHook(head, \"dom:rendered\", { renders: tags }); head._du = false; head.dirty = false; return true; } function registerPlugin(head, p) { const plugin = typeof p === \"function\" ? p(head) : p; const key = plugin.key || String(head.plugins.size + 1); if (!head.plugins.get(key)) { head.plugins.set(key, plugin); for (const k in plugin.hooks || {}) head.hooks?.hook(k, plugin.hooks[k]); } } function createUnhead(renderer, resolvedOptions = {}) { const ssr = !resolvedOptions.document; const entries = new Map(); const plugins = new Map(); const head = { _entryCount: 1, plugins, resolvedOptions, ssr, entries, render: () => renderer(head), use: (p) => registerPlugin(head, p), push(input, _options) { const _i = _options?._index ?? head._entryCount++; const options = _options ? { ..._options } : {}; delete options.head; delete options.onRendered; const entry = { _i, input, options }; entries.set(_i, entry); const active = { _i, dispose() { entries.delete(_i); }, patch(input2) { if (ssr) { entry.input = input2; delete entry._tags; } else { entry._pending = input2; } if (!entries.has(_i)) entries.set(_i, entry); } }; return active; } }; resolvedOptions.init?.forEach((e) => e && head.push(e)); return head; } const DEFAULT_STREAM_KEY = \"__unhead__\"; function init(options = {}) { const { streamKey = DEFAULT_STREAM_KEY } = options; const win = typeof window !== \"undefined\" ? window : void 0; if (!win) return; const queue = win[streamKey]; if (queue?._head) return queue._head; const doc = typeof document !== \"undefined\" ? document : void 0; const head = createUnhead(createDomRenderer(), { document: doc }); let hydrationLocked = true; queueMicrotask(() => { hydrationLocked = false; }); function pushStreamed(entry) { const active = head.push(entry); const stored = head.entries.get(active._i); if (stored) stored._streamed = true; } if (queue?._q) { for (const entries of queue._q) { for (const entry of entries) { pushStreamed(entry); } } head.dirty = true; head.render(); } win[streamKey] = { _q: queue?._q || [], _head: head, _hydrationLocked: () => hydrationLocked, push: (entries) => { for (const entry of entries) { pushStreamed(entry); } head.dirty = true; head.render(); } }; return head; } init(); exports.init = init; return exports; })({});";
2
- export const streamingIifeSize = 15782;
1
+ export const streamingIifeCode = "var __unhead_iife__ = (function (exports) { 'use strict'; const DupeableTags = new Set([\"link\", \"style\", \"script\", \"noscript\"]); const TagsWithInnerContent = new Set([\"title\", \"titleTemplate\", \"script\", \"style\", \"noscript\"]); const HasElementTags = new Set([\"base\", \"meta\", \"link\", \"style\", \"script\", \"noscript\"]); const ValidHeadTags = new Set([\"title\", \"base\", \"htmlAttrs\", \"bodyAttrs\", \"meta\", \"link\", \"style\", \"script\", \"noscript\"]); const UniqueTags = new Set([\"base\", \"title\", \"titleTemplate\", \"bodyAttrs\", \"htmlAttrs\", \"templateParams\"]); const TagConfigKeys = new Set([\"key\", \"tagPosition\", \"tagPriority\", \"tagDuplicateStrategy\", \"innerHTML\", \"textContent\", \"processTemplateParams\"]); const UsesMergeStrategy = new Set([\"templateParams\", \"htmlAttrs\", \"bodyAttrs\"]); const MetaTagsArrayable = new Set([ \"theme-color\", \"google-site-verification\", \"og\", \"article\", \"book\", \"profile\", \"twitter\", \"author\" ]); function callHook(head, hook, ctx) { return head.hooks?.callHook(hook, ctx); } const META_NOREWRITE_RE = /^(?:viewport|description|keywords|robots)$/; function isMetaArrayDupeKey(v) { return MetaTagsArrayable.has(v.split(\":\")[1]); } function dedupeKey(tag) { const { props, tag: t, key } = tag; if (UniqueTags.has(t)) return t; if (t === \"link\" && props.rel === \"canonical\") return \"canonical\"; if (t === \"link\" && props.rel === \"alternate\") { const altKey = props.hreflang || props.type; if (altKey) return `alternate:${altKey}`; } if (props.charset) return \"charset\"; if (t === \"meta\") { for (const n of [\"name\", \"property\", \"http-equiv\"]) { const v = props[n]; if (v !== void 0) return `meta:${v}${(typeof v !== \"string\" || !v.includes(\":\")) && !META_NOREWRITE_RE.test(v) && key ? `:key:${key}` : \"\"}`; } } if (key) return `${t}:key:${key}`; if (props.id) return `${t}:id:${props.id}`; if (t === \"link\" && props.rel === \"alternate\") return `alternate:${props.href || \"\"}`; return TagsWithInnerContent.has(t) && (tag.textContent || tag.innerHTML) ? `${t}:content:${tag.textContent || tag.innerHTML}` : void 0; } function hashTag(tag) { return tag._h || tag._d || tag.textContent || tag.innerHTML || `${tag.tag}:${Object.entries(tag.props).map(([k, v]) => `${k}:${String(v)}`).join()}`; } function walkResolver(val, resolve, key) { if (key === \"_resolver\") return val; if (typeof val === \"function\" && (!key || key !== \"titleTemplate\" && !key.startsWith(\"on\"))) val = val(); const v = resolve ? resolve(key, val) : val; if (Array.isArray(v)) return v.map((r) => walkResolver(r, resolve)); if (v?.constructor === Object) { const next = {}; for (const k in v) { if (k === \"__proto__\" || k === \"constructor\" || k === \"prototype\") continue; next[k] = walkResolver(v[k], resolve, k); } return next; } return v; } function normalizeStyleClassProps(key, value) { const isStyle = key === \"style\"; const store = isStyle ? new Map() : new Set(); const add = (v) => { if (!v) return; if (isStyle) { const i = v.indexOf(\":\"); i > 0 && store.set(v.slice(0, i).trim(), v.slice(i + 1).trim()); } else { v.split(\" \").forEach((c) => c && store.add(c)); } }; if (typeof value === \"string\") { (isStyle ? value.split(\";\") : [value]).forEach(add); } else if (Array.isArray(value)) { value.forEach(add); } else if (value && typeof value === \"object\") { for (const k in value) { const v = value[k]; v && v !== \"false\" && (isStyle ? store.set(k.trim(), String(v)) : add(k)); } } return store; } function normalizeProps(tag, input) { tag.props = tag.props || {}; if (!input) return tag; if (tag.tag === \"templateParams\") { tag.props = input; return tag; } const isHtmlTag = HasElementTags.has(tag.tag) || tag.tag === \"htmlAttrs\" || tag.tag === \"bodyAttrs\"; for (const prop in input) { if (prop === \"__proto__\" || prop === \"constructor\" || prop === \"prototype\") continue; const value = input[prop]; if (value === null) { tag.props[prop] = null; } else if (prop === \"class\" || prop === \"style\") { tag.props[prop] = normalizeStyleClassProps(prop, value); } else if (TagConfigKeys.has(prop)) { if ((prop === \"textContent\" || prop === \"innerHTML\") && typeof value === \"object\") { const type = input.type || \"application/json\"; if (type.endsWith(\"json\") || type === \"speculationrules\" || type === \"importmap\") { tag.props.type = input.type = type; tag[prop] = JSON.stringify(value); } } else { tag[prop] = value; } } else if (value !== void 0) { const isData = prop.startsWith(\"data-\"); const key = isHtmlTag && !isData ? prop.toLowerCase() : prop; const str = String(value); const isMeta = tag.tag === \"meta\" && key === \"content\"; tag.props[key] = str === \"true\" || str === \"\" ? isData || isMeta ? str : true : !value && isData && str === \"false\" ? \"false\" : value; } } return tag; } function normalizeTag(tagName, _input) { const input = typeof _input === \"object\" && typeof _input !== \"function\" ? _input : { [tagName === \"script\" || tagName === \"noscript\" || tagName === \"style\" ? \"innerHTML\" : \"textContent\"]: _input }; const tag = normalizeProps({ tag: tagName, props: {} }, input); if (tag.key && DupeableTags.has(tag.tag)) tag.props[\"data-hid\"] = tag._h = tag.key; if (tag.tag === \"script\" && typeof tag.innerHTML === \"object\") { tag.innerHTML = JSON.stringify(tag.innerHTML); tag.props.type = tag.props.type || \"application/json\"; } return Array.isArray(tag.props.content) ? tag.props.content.map((v) => ({ ...tag, props: { ...tag.props, content: v } })) : tag; } function normalizeEntryToTags(input, propResolvers) { if (!input) return []; if (typeof input === \"function\") input = input(); const resolvers = (key, val) => { for (const r of propResolvers) val = r(key, val); return val; }; input = walkResolver(resolvers(void 0, input), resolvers); const tags = []; for (const key in input) { const value = input[key]; if (value !== void 0) { for (const v of Array.isArray(value) ? value : [value]) tags.push(normalizeTag(key, v)); } } return tags.flat(); } const LT_RE = /</g; const SCRIPT_END_RE = /<\\/script/g; const sortTags = (a, b) => a._w === b._w ? a._p - b._p : a._w - b._w; function dedupeTags(ctx) { let hasFlatMeta = false; for (const next of ctx.tags.sort(sortTags)) { const k = next._d || hashTag(next); const prev = ctx.tagMap.get(k); if (!prev) { ctx.tagMap.set(k, next); continue; } const strategy = next.tagDuplicateStrategy || (UsesMergeStrategy.has(next.tag) ? \"merge\" : null) || (next.key && next.key === prev.key ? \"merge\" : null); if (strategy === \"merge\") { const props = { ...prev.props }; for (const p in next.props) { props[p] = p === \"style\" ? new Map([...prev.props.style || new Map(), ...next.props[p]]) : p === \"class\" ? new Set([...prev.props.class || [], ...next.props[p]]) : next.props[p]; } ctx.tagMap.set(k, { ...next, props }); } else if (next._p >> 10 === prev._p >> 10 && next.tag === \"meta\" && isMetaArrayDupeKey(k)) { ctx.tagMap.set(k, Object.assign([...Array.isArray(prev) ? prev : [prev], next], next)); hasFlatMeta = true; } else if (next._w === prev._w ? next._p > prev._p : next._w < prev._w) { ctx.tagMap.set(k, next); } } return hasFlatMeta; } function resolveTitleTemplate(ctx, head) { const title = ctx.tagMap.get(\"title\"); const tpl = ctx.tagMap.get(\"titleTemplate\"); head._title = title?.textContent; if (!tpl) return; const fn = tpl.textContent; head._titleTemplate = fn; if (!fn) return; let v = typeof fn === \"function\" ? fn(title?.textContent) : fn; if (typeof v === \"string\" && !head.plugins.has(\"template-params\")) v = v.replace(\"%s\", title?.textContent || \"\"); if (title) { v === null ? ctx.tagMap.delete(\"title\") : ctx.tagMap.set(\"title\", { ...title, textContent: v }); } else { ctx.tagMap.set(\"titleTemplate\", { ...tpl, tag: \"title\", textContent: v }); } } function sanitizeTags(tags) { return tags.filter((t) => { const { innerHTML, tag, props } = t; if (!ValidHeadTags.has(tag) || !Object.keys(props).length && !innerHTML && !t.textContent) return false; if (tag === \"meta\" && !props.content && !props[\"http-equiv\"] && !props.charset) return false; if (tag === \"script\" && (innerHTML || t.textContent)) { const type = String(props.type); const isJsonLike = type.endsWith(\"json\") || type === \"importmap\" || type === \"speculationrules\"; 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; if (innerHTML) t.innerHTML = escape(innerHTML); if (t.textContent) t.textContent = escape(t.textContent); t._d = dedupeKey(t); } return true; }); } function resolveTags(head, options) { const weightFn = options?.tagWeight ?? head.resolvedOptions._tagWeight ?? (() => 100); const ctx = { tagMap: new Map(), tags: [] }; const entries = [...head.entries.values()]; for (const e of entries) { if (e._pending !== void 0) { e.input = e._pending; delete e._pending; delete e._tags; } } callHook(head, \"entries:resolve\", { entries, ...ctx }); for (const e of entries) { if (!e._tags) { const normalizeCtx = { tags: normalizeEntryToTags(e.input, head.resolvedOptions.propResolvers || []).map((t) => Object.assign(t, e.options)), entry: e }; callHook(head, \"entries:normalize\", normalizeCtx); e._tags = normalizeCtx.tags.map((t, i) => { t._w = weightFn(t); t._p = (e._i << 10) + i; t._d = dedupeKey(t); if (!t._d) t._h = hashTag(t); return t; }); } } ctx.tags = entries.flatMap((e) => (e._tags || []).map((t) => ({ ...t, props: { ...t.props } }))); const hasFlatMeta = dedupeTags(ctx); resolveTitleTemplate(ctx, head); ctx.tags = [...ctx.tagMap.values()]; if (hasFlatMeta) ctx.tags = ctx.tags.flat().sort(sortTags); callHook(head, \"tags:beforeResolve\", ctx); callHook(head, \"tags:resolve\", ctx); callHook(head, \"tags:afterResolve\", ctx); return sanitizeTags(ctx.tags); } const WHITESPACE_RE = /\\s+/; function createDomRenderer(options = {}) { return (head) => _renderDOMHead(head, options); } function _renderDOMHead(head, options = {}) { const dom = options.document || head.resolvedOptions.document; if (!dom || !head.dirty && ![...head.entries.values()].some((e) => e._pending !== void 0)) return false; const beforeRenderCtx = { shouldRender: true, tags: [] }; callHook(head, \"dom:beforeRender\", beforeRenderCtx); if (!beforeRenderCtx.shouldRender || head._du) return false; head._du = true; let state = head._dom; if (!state) { state = { _t: dom.title, _e: new Map([[\"htmlAttrs\", dom.documentElement], [\"bodyAttrs\", dom.body]]), _p: {}, _s: {} }; for (const el of [...dom.body.children, ...dom.head.children]) { const tag = el.tagName.toLowerCase(); if (!HasElementTags.has(tag)) continue; const props = { innerHTML: el.innerHTML }; for (const n of el.getAttributeNames()) props[n] = el.getAttribute(n); const next = normalizeProps({ tag, props: {} }, props); next.key = el.getAttribute(\"data-hid\") || void 0; let k = next._d = dedupeKey(next) || hashTag(next); let c = 1; while (state._e.has(k)) k = `${next._d}:${c++}`; state._e.set(k, el); } for (const entry of head.entries.values()) { if (entry._o !== void 0) { const orig = entry._o; for (const t of [\"bodyAttrs\", \"htmlAttrs\"]) { const cls = orig[t]?.class; if (typeof cls === \"string\") { const $el = state._e.get(t); for (const c of cls.split(WHITESPACE_RE)) { if (c) state._p[`${t}:attr:class:${c}`] = () => $el.classList.remove(c); } } } delete entry._o; } } } else { state._p = { ...state._s }; } state._s = {}; function track(id, scope, fn) { const k = `${id}:${scope}`; state._s[k] = fn; delete state._p[k]; } function trackCtx({ id, $el, tag }) { const isAttr = tag.tag.endsWith(\"Attrs\"); state._e.set(id, $el); if (!isAttr) { if (tag.textContent && tag.textContent !== $el.textContent) $el.textContent = tag.textContent; if (tag.innerHTML && tag.innerHTML !== $el.innerHTML) $el.innerHTML = tag.innerHTML; track(id, \"el\", () => { $el?.remove(); state._e.delete(id); }); } for (const k in tag.props) { const v = tag.props[k]; if (k[0] === \"o\" && k[1] === \"n\" && typeof v === \"function\") { const ev = k.slice(2); if ($el?.dataset?.[`${k}fired`]) v.call($el, new Event(ev)); if ($el.getAttribute(`data-${k}`) !== \"\") { (tag.tag === \"bodyAttrs\" ? dom.defaultView : $el).addEventListener(ev, v.bind($el)); $el.setAttribute(`data-${k}`, \"\"); } continue; } const ck = `attr:${k}`; if (k === \"class\" && v) { for (const c of v) { if (isAttr) track(id, `${ck}:${c}`, () => $el.classList.remove(c)); if (!$el.classList.contains(c)) $el.classList.add(c); } } else if (k === \"style\" && v) { for (const [sk, sv] of v) { track(id, `${ck}:${sk}`, () => $el.style.removeProperty(sk)); $el.style.setProperty(sk, sv); } } else if (v !== false && v !== null) { if ($el.getAttribute(k) !== v) $el.setAttribute(k, v === true ? \"\" : String(v)); if (isAttr) track(id, ck, () => $el.removeAttribute(k)); } } } const pending = []; const frag = {}; const rawTags = resolveTags(head, options.tagWeight ? { tagWeight: options.tagWeight } : void 0); const tags = []; const dupeKeyCounter = new Map(); for (const tag of rawTags) { const count = dupeKeyCounter.get(tag._d) || 0; const id = (count ? `${tag._d}:${count}` : tag._d) || tag._h; const ctx = { tag, id, shouldRender: true }; if (tag._d && isMetaArrayDupeKey(tag._d)) dupeKeyCounter.set(tag._d, count + 1); tags.push(ctx); if (tag.tag === \"title\") { dom.title = tag.textContent; track(\"title\", \"\", () => dom.title = state._t); continue; } ctx.$el = state._e.get(id); if (ctx.$el) trackCtx(ctx); else if (HasElementTags.has(tag.tag)) pending.push(ctx); } for (const ctx of pending) { ctx.$el = dom.createElement(ctx.tag.tag); trackCtx(ctx); (frag[ctx.tag.tagPosition || \"head\"] ??= dom.createDocumentFragment()).appendChild(ctx.$el); } if (frag.head) dom.head.appendChild(frag.head); if (frag.bodyOpen) dom.body.insertBefore(frag.bodyOpen, dom.body.firstChild); if (frag.bodyClose) dom.body.appendChild(frag.bodyClose); for (const k in state._p) state._p[k](); head._dom = state; callHook(head, \"dom:rendered\", { renders: tags }); head._du = false; head.dirty = false; return true; } function registerPlugin(head, p) { const plugin = typeof p === \"function\" ? p(head) : p; const key = plugin.key || String(head.plugins.size + 1); if (!head.plugins.get(key)) { head.plugins.set(key, plugin); for (const k in plugin.hooks || {}) head.hooks?.hook(k, plugin.hooks[k]); } } function createUnhead(renderer, resolvedOptions = {}) { const ssr = !resolvedOptions.document; const entries = new Map(); const plugins = new Map(); const head = { _entryCount: 1, plugins, resolvedOptions, ssr, entries, render: () => renderer(head), use: (p) => registerPlugin(head, p), push(input, _options) { const _i = _options?._index ?? head._entryCount++; const options = _options ? { ..._options } : {}; delete options.head; delete options.onRendered; const entry = { _i, input, options }; entries.set(_i, entry); const active = { _i, dispose() { entries.delete(_i); }, patch(input2) { if (ssr) { entry.input = input2; delete entry._tags; } else { entry._pending = input2; } if (!entries.has(_i)) entries.set(_i, entry); } }; return active; } }; resolvedOptions.init?.forEach((e) => e && head.push(e)); return head; } const DEFAULT_STREAM_KEY = \"__unhead__\"; function init(options = {}) { const { streamKey = DEFAULT_STREAM_KEY } = options; const win = typeof window !== \"undefined\" ? window : void 0; if (!win) return; const queue = win[streamKey]; if (queue?._head) return queue._head; const doc = typeof document !== \"undefined\" ? document : void 0; const head = createUnhead(createDomRenderer(), { document: doc }); let hydrationLocked = true; queueMicrotask(() => { hydrationLocked = false; }); function pushStreamed(entry) { const active = head.push(entry); const stored = head.entries.get(active._i); if (stored) stored._streamed = true; } if (queue?._q) { for (const entries of queue._q) { for (const entry of entries) { pushStreamed(entry); } } head.dirty = true; head.render(); } win[streamKey] = { _q: queue?._q || [], _head: head, _hydrationLocked: () => hydrationLocked, push: (entries) => { for (const entry of entries) { pushStreamed(entry); } head.dirty = true; head.render(); } }; return head; } init(); exports.init = init; return exports; })({});";
2
+ export const streamingIifeSize = 16038;
@@ -1,6 +1,6 @@
1
- import { S as ServerUnhead } from '../shared/unhead.B825tVHL.mjs';
2
- import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.D6A03PN3.mjs';
3
- import { ak as ResolvableHead } from '../shared/unhead.Dyr7L2Ht.mjs';
1
+ import { S as ServerUnhead } from '../shared/unhead.DvMT2vYs.mjs';
2
+ import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.CyKsApKH.mjs';
3
+ import { as as ResolvableHead } from '../shared/unhead.5pUZeb0i.mjs';
4
4
  import 'hookable';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { S as ServerUnhead } from '../shared/unhead.cnX_MFeG.js';
2
- import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.DmIUoNyg.js';
3
- import { ak as ResolvableHead } from '../shared/unhead.Dyr7L2Ht.js';
1
+ import { S as ServerUnhead } from '../shared/unhead.BRPfhzdc.js';
2
+ import { f as CreateStreamableServerHeadOptions, U as Unhead, s as SSRHeadPayload } from '../shared/unhead.BEof8Qjb.js';
3
+ import { as as ResolvableHead } from '../shared/unhead.5pUZeb0i.js';
4
4
  import 'hookable';
5
5
 
6
6
  /**
@@ -1,18 +1,28 @@
1
1
  import { parseHtmlForIndexes, applyHeadToHtml } from '../parser.mjs';
2
- import { c as createHead } from '../shared/unhead.Sr8_Iw6G.mjs';
2
+ import { c as createHead } from '../shared/unhead.C5ypJnIO.mjs';
3
3
  import { DEFAULT_STREAM_KEY } from './client.mjs';
4
4
  import '../shared/unhead.CfgPMHXt.mjs';
5
5
  import '../shared/unhead.DvIxXxuO.mjs';
6
6
  import 'hookable';
7
- import '../shared/unhead.DQiBmCqH.mjs';
7
+ import '../shared/unhead.DiRbsb3I.mjs';
8
8
  import '../shared/unhead.fg-0ge_u.mjs';
9
9
 
10
10
  const LT_RE = /</g;
11
11
  const GT_RE = />/g;
12
12
  const AMP_RE = /&/g;
13
+ const VALID_STREAM_KEY_RE = /^[$_a-z][$\w]*$/i;
14
+ function assertValidStreamKey(streamKey) {
15
+ if (typeof streamKey !== "string" || !VALID_STREAM_KEY_RE.test(streamKey)) {
16
+ throw new Error(
17
+ `[unhead] Invalid streamKey: must be a valid JavaScript identifier matching ${VALID_STREAM_KEY_RE}. Received: ${JSON.stringify(streamKey)}`
18
+ );
19
+ }
20
+ }
13
21
  // @__NO_SIDE_EFFECTS__
14
22
  function createStreamableHead(options = {}) {
15
23
  const { streamKey, ...rest } = options;
24
+ if (streamKey !== void 0)
25
+ assertValidStreamKey(streamKey);
16
26
  const head = createHead({
17
27
  ...rest,
18
28
  experimentalStreamKey: streamKey
@@ -28,9 +38,12 @@ function createStreamableHead(options = {}) {
28
38
  };
29
39
  }
30
40
  function getStreamKey(head) {
31
- return head.resolvedOptions.experimentalStreamKey || DEFAULT_STREAM_KEY;
41
+ const key = head.resolvedOptions.experimentalStreamKey || DEFAULT_STREAM_KEY;
42
+ assertValidStreamKey(key);
43
+ return key;
32
44
  }
33
45
  function createBootstrapScript(streamKey = DEFAULT_STREAM_KEY) {
46
+ assertValidStreamKey(streamKey);
34
47
  return `<script>window.${streamKey}={_q:[],push(e){this._q.push(e)}}<\/script>`;
35
48
  }
36
49
  function renderShell(head) {
package/dist/types.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.D6A03PN3.mjs';
2
- export { R as RenderDomHeadOptions } from './shared/unhead.DbDvRsnF.mjs';
3
- export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.BiaRAmcT.mjs';
4
- import { B as Booleanable } from './shared/unhead.Dyr7L2Ht.mjs';
5
- export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AppleTouchIconLink, e as ApplicationJsonScript, f as Arrayable, g as AuthorLink, h as BareAlternateLink, i as BodyAttributesWithoutEvents, j as BodyEvents, C as CanonicalLink, k as CharsetMeta, D as DataKeys, l as DeepResolvableProperties, m as DnsPrefetchLink, E as ExternalScript, F as FaviconLink, G as GenericLink, n as GenericScript, o as GlobalAttributes, H as HasTemplateParams, p as HeadTag, q as HeadTagKeys, r as HelpLink, s as HttpEquivMeta, t as HttpEventAttributes, I as IconLink, u as ImportMapConfig, v as ImportMapScript, w as InlineModuleScript, x as InlineScript, y as InnerContent, z as InnerContentVal, J as InternalTagKey, K as JsonLdScript, L as KnownLinkRel, M as LicenseLink, N as Link, O as LinkBase, P as LinkHttpEvents, Q as ManifestLink, R as MaskIconLink, S as MaybeArray, T as MaybeEventFnHandlers, U as Meta, V as MetaBase, W as MetaFlat, X as MetaGeneric, Y as MetaNames, Z as MetaProperties, _ as ModuleScript, $ as ModulepreloadLink, a0 as NameMeta, a1 as Never, a2 as NextLink, a3 as PingbackLink, a4 as PreconnectLink, a5 as PrefetchLink, a6 as PreloadFontLink, a7 as PreloadImageLink, a8 as PreloadLink, a9 as PreloadLinkBase, aa as PreloadOtherLink, ab as PreloadScriptLink, ac as PreloadStyleLink, ad as PrerenderLink, ae as PrevLink, af as ProcessesTemplateParams, ag as PropertyMeta, ah as RawInput, ai as ResolvableBase, aj as ResolvableBodyAttributes, ak as ResolvableHead, al as ResolvableHtmlAttributes, am as ResolvableLink, an as ResolvableMeta, ao as ResolvableNoscript, ap as ResolvableProperties, aq as ResolvableScript, ar as ResolvableStyle, as as ResolvableTemplateParams, at as ResolvableTitle, au as ResolvableTitleTemplate, av as ResolvableUnion, aw as ResolvableValue, ax as ResolvesDuplicates, ay as SchemaAugmentations, az as Script, aA as ScriptBase, aB as ScriptHttpEvents, aC as SearchLink, aD as SerializableHead, aE as SpeculationRules, aF as SpeculationRulesScript, aG as StringInnerContent, aH as Stringable, aI as StylesheetLink, aJ as TagKey, aK as TagPosition, aL as TagPriority, aM as TagUserProperties, aN as TemplateParams, aO as TemplateParamsAugmentations, aP as UnheadBodyAttributesWithoutEvents, aQ as UnheadHtmlAttributes, aR as UnheadMeta, aS as UseHeadInput, aT as UseSeoMetaInput, aU as ValidTagPositions } from './shared/unhead.Dyr7L2Ht.mjs';
1
+ export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.CyKsApKH.mjs';
2
+ export { R as RenderDomHeadOptions } from './shared/unhead.BAv4ddL5.mjs';
3
+ export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.CUEmFl2d.mjs';
4
+ import { B as Booleanable } from './shared/unhead.5pUZeb0i.mjs';
5
+ export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AlternateStylesheetLink, e as AppleTouchIconLink, f as ApplicationJsonScript, g as Arrayable, h as AuthorLink, i as BareAlternateLink, j as BodyAttributesWithoutEvents, k as BodyEvents, C as CanonicalLink, l as CharsetMeta, m as CompressionDictionaryLink, D as DataKeys, n as DeepResolvableProperties, o as DnsPrefetchLink, E as ExpectLink, p as ExternalScript, F as FaviconLink, G as GenericLink, q as GenericScript, r as GlobalAttributes, H as HasTemplateParams, s as HeadTag, t as HeadTagKeys, u as HelpLink, v as HttpEquivMeta, w as HttpEventAttributes, I as IconLink, x as ImportMapConfig, y as ImportMapScript, z as InferLink, J as InferScript, K as InlineModuleScript, L as InlineScript, M as InnerContent, N as InnerContentVal, O as InternalTagKey, P as JsonLdScript, Q as KnownLinkRel, R as KnownScriptType, S as LicenseLink, T as Link, U as LinkBase, V as LinkHttpEvents, W as ManifestLink, X as MaskIconLink, Y as MaybeArray, Z as MaybeEventFnHandlers, _ as MeLink, $ as Meta, a0 as MetaBase, a1 as MetaFlat, a2 as MetaGeneric, a3 as MetaNames, a4 as MetaProperties, a5 as ModuleScript, a6 as ModulepreloadLink, a7 as NameMeta, a8 as Never, a9 as NextLink, aa as PingbackLink, ab as PreconnectLink, ac as PrefetchLink, ad as PreloadFontLink, ae as PreloadImageLink, af as PreloadLink, ag as PreloadLinkBase, ah as PreloadOtherLink, ai as PreloadScriptLink, aj as PreloadStyleLink, ak as PrerenderLink, al as PrevLink, am as PrivacyPolicyLink, an as ProcessesTemplateParams, ao as PropertyMeta, ap as RawInput, aq as ResolvableBase, ar as ResolvableBodyAttributes, as as ResolvableHead, at as ResolvableHtmlAttributes, au as ResolvableLink, av as ResolvableMeta, aw as ResolvableNoscript, ax as ResolvableProperties, ay as ResolvableScript, az as ResolvableStyle, aA as ResolvableTemplateParams, aB as ResolvableTitle, aC as ResolvableTitleTemplate, aD as ResolvableUnion, aE as ResolvableValue, aF as ResolvesDuplicates, aG as SchemaAugmentations, aH as Script, aI as ScriptBase, aJ as ScriptHttpEvents, aK as SearchLink, aL as SerializableHead, aM as SpeculationRules, aN as SpeculationRulesScript, aO as StringInnerContent, aP as Stringable, aQ as StylesheetLink, aR as TagKey, aS as TagPosition, aT as TagPriority, aU as TagUserProperties, aV as TemplateParams, aW as TemplateParamsAugmentations, aX as TermsOfServiceLink, aY as UnheadBodyAttributesWithoutEvents, aZ as UnheadHtmlAttributes, a_ as UnheadMeta, a$ as UseHeadInput, b0 as UseSeoMetaInput, b1 as ValidTagPositions, b2 as WebmentionLink } from './shared/unhead.5pUZeb0i.mjs';
6
6
  export { createSpyProxy } from './scripts.mjs';
7
- export { u as useScript } from './shared/unhead.DyN7hSCT.mjs';
7
+ export { u as useScript } from './shared/unhead.dhQT0IKI.mjs';
8
8
  import 'hookable';
9
9
 
10
10
  interface AriaAttributes {
package/dist/types.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.DmIUoNyg.js';
2
- export { R as RenderDomHeadOptions } from './shared/unhead.DvZZ4Zb_.js';
3
- export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.DKz0V2If.js';
4
- import { B as Booleanable } from './shared/unhead.Dyr7L2Ht.js';
5
- export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AppleTouchIconLink, e as ApplicationJsonScript, f as Arrayable, g as AuthorLink, h as BareAlternateLink, i as BodyAttributesWithoutEvents, j as BodyEvents, C as CanonicalLink, k as CharsetMeta, D as DataKeys, l as DeepResolvableProperties, m as DnsPrefetchLink, E as ExternalScript, F as FaviconLink, G as GenericLink, n as GenericScript, o as GlobalAttributes, H as HasTemplateParams, p as HeadTag, q as HeadTagKeys, r as HelpLink, s as HttpEquivMeta, t as HttpEventAttributes, I as IconLink, u as ImportMapConfig, v as ImportMapScript, w as InlineModuleScript, x as InlineScript, y as InnerContent, z as InnerContentVal, J as InternalTagKey, K as JsonLdScript, L as KnownLinkRel, M as LicenseLink, N as Link, O as LinkBase, P as LinkHttpEvents, Q as ManifestLink, R as MaskIconLink, S as MaybeArray, T as MaybeEventFnHandlers, U as Meta, V as MetaBase, W as MetaFlat, X as MetaGeneric, Y as MetaNames, Z as MetaProperties, _ as ModuleScript, $ as ModulepreloadLink, a0 as NameMeta, a1 as Never, a2 as NextLink, a3 as PingbackLink, a4 as PreconnectLink, a5 as PrefetchLink, a6 as PreloadFontLink, a7 as PreloadImageLink, a8 as PreloadLink, a9 as PreloadLinkBase, aa as PreloadOtherLink, ab as PreloadScriptLink, ac as PreloadStyleLink, ad as PrerenderLink, ae as PrevLink, af as ProcessesTemplateParams, ag as PropertyMeta, ah as RawInput, ai as ResolvableBase, aj as ResolvableBodyAttributes, ak as ResolvableHead, al as ResolvableHtmlAttributes, am as ResolvableLink, an as ResolvableMeta, ao as ResolvableNoscript, ap as ResolvableProperties, aq as ResolvableScript, ar as ResolvableStyle, as as ResolvableTemplateParams, at as ResolvableTitle, au as ResolvableTitleTemplate, av as ResolvableUnion, aw as ResolvableValue, ax as ResolvesDuplicates, ay as SchemaAugmentations, az as Script, aA as ScriptBase, aB as ScriptHttpEvents, aC as SearchLink, aD as SerializableHead, aE as SpeculationRules, aF as SpeculationRulesScript, aG as StringInnerContent, aH as Stringable, aI as StylesheetLink, aJ as TagKey, aK as TagPosition, aL as TagPriority, aM as TagUserProperties, aN as TemplateParams, aO as TemplateParamsAugmentations, aP as UnheadBodyAttributesWithoutEvents, aQ as UnheadHtmlAttributes, aR as UnheadMeta, aS as UseHeadInput, aT as UseSeoMetaInput, aU as ValidTagPositions } from './shared/unhead.Dyr7L2Ht.js';
1
+ export { A as ActiveHeadEntry, a as AsVoidFunctions, C as ClientHeadHooks, b as CoreHeadHooks, c as CreateClientHeadOptions, d as CreateHeadOptions, e as CreateServerHeadOptions, f as CreateStreamableServerHeadOptions, D as DOMHeadHooks, g as DomBeforeRenderCtx, h as DomRenderTagContext, i as DomState, E as EntryResolveCtx, j as EventHandlerOptions, H as HeadEntry, k as HeadEntryOptions, l as HeadHooks, m as HeadPlugin, n as HeadPluginInput, o as HeadPluginOptions, p as HeadRenderer, q as HookResult, P as PropResolver, R as RecordingEntry, r as RenderSSRHeadOptions, S as SSRHeadHooks, s as SSRHeadPayload, t as SSRRenderContext, u as ScriptInstance, v as ServerHeadHooks, w as ShouldRenderContext, x as SideEffectsRecord, y as SyncHookResult, U as Unhead, z as UseFunctionType, B as UseScriptContext, F as UseScriptInput, G as UseScriptOptions, I as UseScriptResolvedInput, J as UseScriptReturn, K as UseScriptStatus, W as WarmupStrategy } from './shared/unhead.BEof8Qjb.js';
2
+ export { R as RenderDomHeadOptions } from './shared/unhead.JGBJYEOZ.js';
3
+ export { B as Base, a as BodyAttributes, H as HeadSafe, b as HtmlAttributes, N as Noscript, S as SafeBodyAttr, c as SafeHtmlAttr, d as SafeLink, e as SafeMeta, f as SafeNoscript, g as SafeScript, h as SafeStyle, i as Style } from './shared/unhead.UFdAtJOd.js';
4
+ import { B as Booleanable } from './shared/unhead.5pUZeb0i.js';
5
+ export { A as AlternateFeedLink, a as AlternateLanguageLink, b as AlternateLink, c as AlternateMediaLink, d as AlternateStylesheetLink, e as AppleTouchIconLink, f as ApplicationJsonScript, g as Arrayable, h as AuthorLink, i as BareAlternateLink, j as BodyAttributesWithoutEvents, k as BodyEvents, C as CanonicalLink, l as CharsetMeta, m as CompressionDictionaryLink, D as DataKeys, n as DeepResolvableProperties, o as DnsPrefetchLink, E as ExpectLink, p as ExternalScript, F as FaviconLink, G as GenericLink, q as GenericScript, r as GlobalAttributes, H as HasTemplateParams, s as HeadTag, t as HeadTagKeys, u as HelpLink, v as HttpEquivMeta, w as HttpEventAttributes, I as IconLink, x as ImportMapConfig, y as ImportMapScript, z as InferLink, J as InferScript, K as InlineModuleScript, L as InlineScript, M as InnerContent, N as InnerContentVal, O as InternalTagKey, P as JsonLdScript, Q as KnownLinkRel, R as KnownScriptType, S as LicenseLink, T as Link, U as LinkBase, V as LinkHttpEvents, W as ManifestLink, X as MaskIconLink, Y as MaybeArray, Z as MaybeEventFnHandlers, _ as MeLink, $ as Meta, a0 as MetaBase, a1 as MetaFlat, a2 as MetaGeneric, a3 as MetaNames, a4 as MetaProperties, a5 as ModuleScript, a6 as ModulepreloadLink, a7 as NameMeta, a8 as Never, a9 as NextLink, aa as PingbackLink, ab as PreconnectLink, ac as PrefetchLink, ad as PreloadFontLink, ae as PreloadImageLink, af as PreloadLink, ag as PreloadLinkBase, ah as PreloadOtherLink, ai as PreloadScriptLink, aj as PreloadStyleLink, ak as PrerenderLink, al as PrevLink, am as PrivacyPolicyLink, an as ProcessesTemplateParams, ao as PropertyMeta, ap as RawInput, aq as ResolvableBase, ar as ResolvableBodyAttributes, as as ResolvableHead, at as ResolvableHtmlAttributes, au as ResolvableLink, av as ResolvableMeta, aw as ResolvableNoscript, ax as ResolvableProperties, ay as ResolvableScript, az as ResolvableStyle, aA as ResolvableTemplateParams, aB as ResolvableTitle, aC as ResolvableTitleTemplate, aD as ResolvableUnion, aE as ResolvableValue, aF as ResolvesDuplicates, aG as SchemaAugmentations, aH as Script, aI as ScriptBase, aJ as ScriptHttpEvents, aK as SearchLink, aL as SerializableHead, aM as SpeculationRules, aN as SpeculationRulesScript, aO as StringInnerContent, aP as Stringable, aQ as StylesheetLink, aR as TagKey, aS as TagPosition, aT as TagPriority, aU as TagUserProperties, aV as TemplateParams, aW as TemplateParamsAugmentations, aX as TermsOfServiceLink, aY as UnheadBodyAttributesWithoutEvents, aZ as UnheadHtmlAttributes, a_ as UnheadMeta, a$ as UseHeadInput, b0 as UseSeoMetaInput, b1 as ValidTagPositions, b2 as WebmentionLink } from './shared/unhead.5pUZeb0i.js';
6
6
  export { createSpyProxy } from './scripts.js';
7
- export { u as useScript } from './shared/unhead.Cp3HtzBy.js';
7
+ export { u as useScript } from './shared/unhead.vQPF0cJs.js';
8
8
  import 'hookable';
9
9
 
10
10
  interface AriaAttributes {
package/dist/utils.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { p as HeadTag, W as MetaFlat, ak as ResolvableHead, aN as TemplateParams } from './shared/unhead.Dyr7L2Ht.mjs';
2
- import { P as PropResolver, U as Unhead } from './shared/unhead.D6A03PN3.mjs';
1
+ import { s as HeadTag, a1 as MetaFlat, as as ResolvableHead, aV as TemplateParams } from './shared/unhead.5pUZeb0i.mjs';
2
+ import { P as PropResolver, U as Unhead } from './shared/unhead.CyKsApKH.mjs';
3
3
  import 'hookable';
4
4
 
5
5
  declare const SelfClosingTags: Set<string>;
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { p as HeadTag, W as MetaFlat, ak as ResolvableHead, aN as TemplateParams } from './shared/unhead.Dyr7L2Ht.js';
2
- import { P as PropResolver, U as Unhead } from './shared/unhead.DmIUoNyg.js';
1
+ import { s as HeadTag, a1 as MetaFlat, as as ResolvableHead, aV as TemplateParams } from './shared/unhead.5pUZeb0i.js';
2
+ import { P as PropResolver, U as Unhead } from './shared/unhead.BEof8Qjb.js';
3
3
  import 'hookable';
4
4
 
5
5
  declare const SelfClosingTags: Set<string>;
package/dist/utils.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { D as DupeableTags, H as HasElementTags, M as MetaTagsArrayable, S as ScriptNetworkEvents, a as SelfClosingTags, T as TagConfigKeys, b as TagPriorityAliases, c as TagsWithInnerContent, U as UniqueTags, d as UsesMergeStrategy, V as ValidHeadTags } from './shared/unhead.fg-0ge_u.mjs';
2
- export { d as dedupeKey, a as dedupeTags, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, b as normalizeProps, r as resolveTags, c as resolveTitleTemplate, s as sanitizeTags, w as walkResolver } from './shared/unhead.DQiBmCqH.mjs';
2
+ export { d as dedupeKey, a as dedupeTags, h as hashTag, i as isMetaArrayDupeKey, n as normalizeEntryToTags, b as normalizeProps, r as resolveTags, c as resolveTitleTemplate, s as sanitizeTags, w as walkResolver } from './shared/unhead.DiRbsb3I.mjs';
3
3
  export { r as resolveMetaKeyType, a as resolveMetaKeyValue, b as resolvePackedMetaObjectValue, u as unpackMeta } from './shared/unhead.JWUDzlIs.mjs';
4
4
  export { p as processTemplateParams } from './shared/unhead.BGFxPGPQ.mjs';
5
5
  import './shared/unhead.DvIxXxuO.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.0.1",
5
5
  "description": "Full-stack <head> manager built for any framework.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",