@unhead/bundler 3.0.5 → 3.1.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 (83) hide show
  1. package/README.md +0 -15
  2. package/dist/devtools-ui/200.html +1 -1
  3. package/dist/devtools-ui/404.html +1 -1
  4. package/dist/devtools-ui/_nuxt/2R9QS7Fj.js +1 -0
  5. package/dist/devtools-ui/_nuxt/Bb_3BFDc.js +1 -0
  6. package/dist/devtools-ui/_nuxt/C81xmMuP.js +1 -0
  7. package/dist/devtools-ui/_nuxt/CCYIWYmq.js +1 -0
  8. package/dist/devtools-ui/_nuxt/CLWRWTUc.js +1 -0
  9. package/dist/devtools-ui/_nuxt/ChL3K-7X.js +1 -0
  10. package/dist/devtools-ui/_nuxt/Ct3QmJw6.js +1 -0
  11. package/dist/devtools-ui/_nuxt/D-Etbhpg.js +1 -0
  12. package/dist/devtools-ui/_nuxt/DAKdquko.js +1 -0
  13. package/dist/devtools-ui/_nuxt/DBeHrZGS.js +1 -0
  14. package/dist/devtools-ui/_nuxt/DPCTmUYV.js +1 -0
  15. package/dist/devtools-ui/_nuxt/DZ2eF3EI.js +1 -0
  16. package/dist/devtools-ui/_nuxt/DevtoolsKeyValue.M9_a09GB.css +1 -0
  17. package/dist/devtools-ui/_nuxt/DevtoolsTagTable.B0gJ7h62.css +1 -0
  18. package/dist/devtools-ui/_nuxt/{DevtoolsTip.By8OtGoF.css → DevtoolsTip.Di2k2xeK.css} +1 -1
  19. package/dist/devtools-ui/_nuxt/DgVGCDvY.js +1 -0
  20. package/dist/devtools-ui/_nuxt/DsxXb4gA.js +191 -0
  21. package/dist/devtools-ui/_nuxt/GDfpgsTy.js +1 -0
  22. package/dist/devtools-ui/_nuxt/OCodeBlock.PlkyOOuq.css +1 -0
  23. package/dist/devtools-ui/_nuxt/Ou52Vqik.js +1 -0
  24. package/dist/devtools-ui/_nuxt/builds/latest.json +1 -1
  25. package/dist/devtools-ui/_nuxt/builds/meta/131284c6-b351-4ba5-8ac9-6320fa409f91.json +1 -0
  26. package/dist/devtools-ui/_nuxt/entry.BIq0UsGv.css +1 -0
  27. package/dist/devtools-ui/_nuxt/error-404.DhI8zfQF.css +1 -0
  28. package/dist/devtools-ui/_nuxt/error-500.BLpai_3s.css +1 -0
  29. package/dist/devtools-ui/_nuxt/identity.C-pUYhOl.css +1 -0
  30. package/dist/devtools-ui/_nuxt/schema-validation.5FNvfDML.css +1 -0
  31. package/dist/devtools-ui/_nuxt/schema.DAhpSINo.css +1 -0
  32. package/dist/devtools-ui/_nuxt/{scripts.UkRMfT5v.css → scripts.BbrQ9ioA.css} +1 -1
  33. package/dist/devtools-ui/_nuxt/serp.C68Pg8m3.css +1 -0
  34. package/dist/devtools-ui/_nuxt/uY6k474J.js +1 -0
  35. package/dist/devtools-ui/_nuxt/xSwJ5b7x.js +1 -0
  36. package/dist/devtools-ui/index.html +1 -1
  37. package/dist/framework.d.mts +72 -0
  38. package/dist/framework.d.ts +72 -0
  39. package/dist/framework.mjs +102 -0
  40. package/dist/minify/esbuild.d.mts +1 -1
  41. package/dist/minify/esbuild.d.ts +1 -1
  42. package/dist/minify/lightningcss.d.mts +1 -1
  43. package/dist/minify/lightningcss.d.ts +1 -1
  44. package/dist/minify/rolldown.d.mts +1 -1
  45. package/dist/minify/rolldown.d.ts +1 -1
  46. package/dist/shared/{bundler.CXyDmCqn.mjs → bundler.D9eYJXZg.mjs} +312 -3
  47. package/dist/shared/{bundler.BwKIGaKX.d.mts → bundler.LjD9SWtb.d.mts} +17 -2
  48. package/dist/shared/{bundler.BwKIGaKX.d.ts → bundler.LjD9SWtb.d.ts} +17 -2
  49. package/dist/vite.d.mts +10 -2
  50. package/dist/vite.d.ts +10 -2
  51. package/dist/vite.mjs +9 -244
  52. package/package.json +26 -14
  53. package/dist/devtools-ui/_nuxt/B4E3K9Fu.js +0 -1
  54. package/dist/devtools-ui/_nuxt/BMUkMEmv.js +0 -1
  55. package/dist/devtools-ui/_nuxt/BWpSa8Y9.js +0 -1
  56. package/dist/devtools-ui/_nuxt/BhGkw7Dk.js +0 -1
  57. package/dist/devtools-ui/_nuxt/Bhqqi5fM.js +0 -1
  58. package/dist/devtools-ui/_nuxt/CbZZKQdd.js +0 -1
  59. package/dist/devtools-ui/_nuxt/Cmcm1MM8.js +0 -1
  60. package/dist/devtools-ui/_nuxt/CtFJRg95.js +0 -1
  61. package/dist/devtools-ui/_nuxt/D3kFDrsW.js +0 -1
  62. package/dist/devtools-ui/_nuxt/DBI97vI-.js +0 -1
  63. package/dist/devtools-ui/_nuxt/DF0wUzLT.js +0 -1
  64. package/dist/devtools-ui/_nuxt/DNL7PE-I.js +0 -1
  65. package/dist/devtools-ui/_nuxt/DVtdvxJ7.js +0 -184
  66. package/dist/devtools-ui/_nuxt/DevtoolsKeyValue.CGQNexGc.css +0 -1
  67. package/dist/devtools-ui/_nuxt/DevtoolsTagTable.Bi_gUiSE.css +0 -1
  68. package/dist/devtools-ui/_nuxt/OCodeBlock.cuqShMa1.css +0 -1
  69. package/dist/devtools-ui/_nuxt/builds/meta/35b427b0-d95c-4e8c-ba8f-41688b3cc0a3.json +0 -1
  70. package/dist/devtools-ui/_nuxt/ddqlfTNL.js +0 -1
  71. package/dist/devtools-ui/_nuxt/entry.clcQIxBm.css +0 -1
  72. package/dist/devtools-ui/_nuxt/error-404.CfdWat2O.css +0 -1
  73. package/dist/devtools-ui/_nuxt/error-500.By77bS06.css +0 -1
  74. package/dist/devtools-ui/_nuxt/identity.qqB_zwgO.css +0 -1
  75. package/dist/devtools-ui/_nuxt/oWUcG044.js +0 -1
  76. package/dist/devtools-ui/_nuxt/p7SZRf-U.js +0 -1
  77. package/dist/devtools-ui/_nuxt/schema-validation.CRmraV8c.css +0 -1
  78. package/dist/devtools-ui/_nuxt/schema.CFjU2dVl.css +0 -1
  79. package/dist/devtools-ui/_nuxt/serp.CZGidvZH.css +0 -1
  80. package/dist/devtools-ui/_nuxt/zAl29A3_.js +0 -1
  81. package/dist/webpack.d.mts +0 -5
  82. package/dist/webpack.d.ts +0 -5
  83. package/dist/webpack.mjs +0 -31
@@ -0,0 +1 @@
1
+ import{as as $,G as y,aa as t,u as x,o as B,ap as r,aR as D,C as d,l as S,a5 as _,x as n,ag as w,t as f,aj as u,v as k,i as b,b as V,af as j,B as v,k as N,a7 as O}from"./DsxXb4gA.js";import{_ as z}from"./ChL3K-7X.js";function I(o=2e3){const{copy:l,copied:s}=$({legacy:!0,copiedDuring:o});return{copy:l,copied:s}}const R=y({__name:"DevtoolsCopyButton",props:{text:{}},setup(o){const{copy:l,copied:s}=I();return(p,c)=>{const a=S,g=B;return t(),x(g,{text:r(s)?"Copied!":"Copy"},{default:D(()=>[d(a,{icon:r(s)?"i-carbon-checkmark":"i-carbon-copy","aria-label":r(s)?"Copied":"Copy to clipboard",size:"xs",variant:"ghost",color:"neutral",class:_(r(s)?"text-green-500":""),onClick:c[0]||(c[0]=i=>r(l)(o.text))},null,8,["icon","aria-label","class"])]),_:1},8,["text"])}}}),h=Object.assign(R,{__name:"DevtoolsCopyButton"}),U={class:"devtools-snippet"},K={key:0,class:"devtools-snippet-header"},L={class:"text-xs font-mono text-muted"},T=y({__name:"DevtoolsSnippet",props:{label:{},code:{},lang:{default:"json"}},setup(o){return(l,s)=>{const p=h,c=z;return t(),n("div",U,[o.label||l.$slots.header?(t(),n("div",K,[w(l.$slots,"header",{},()=>[f("code",L,u(o.label),1)],!0),d(p,{text:o.code},null,8,["text"])])):k("",!0),d(c,{code:o.code,lang:o.lang,class:"devtools-snippet-block"},null,8,["code","lang"])])}}}),A=Object.assign(b(T,[["__scopeId","data-v-1994adf5"]]),{__name:"DevtoolsSnippet"}),E={class:"divide-y divide-[var(--ui-border)]"},F={class:"devtools-kv-key"},G=["href"],q=["href"],H=y({__name:"DevtoolsKeyValue",props:{items:{},striped:{type:Boolean,default:!1}},setup(o){const l=/^https?:\/\/\S+$/,s=/^#(?:[0-9a-f]{3,4}){1,2}$|^rgba?\([\d\s,./]+\)$|^hsla?\([\d\s%,./]+\)$/i;function p(a){return!a.link&&!a.code&&typeof a.value=="string"&&l.test(a.value)}function c(a){return typeof a.value=="string"&&s.test(a.value.trim())}return(a,g)=>{const i=N,m=A,C=h;return t(),n("div",E,[(t(!0),n(V,null,j(o.items,e=>(t(),n("div",{key:e.key,class:_(["devtools-kv-row group",{"devtools-kv-striped":o.striped,"devtools-kv-stacked":!!e.code}])},[f("span",F,u(e.key),1),f("div",{class:_(["devtools-kv-value-wrap",{"w-full":!!e.code}])},[e.link?(t(),n("a",{key:0,href:e.link,target:"_blank",rel:"noopener noreferrer",class:"text-xs text-muted hover:text-default flex items-center gap-1"},[v(u(e.value)+" ",1),d(i,{name:"i-carbon-launch",class:"text-xs"})],8,G)):e.code&&e.value!==void 0&&e.value!==""?(t(),x(m,{key:1,code:String(e.value),lang:e.code,class:"w-full"},null,8,["code","lang"])):p(e)?(t(),n("a",{key:2,href:String(e.value),target:"_blank",rel:"noopener noreferrer",class:"text-xs text-muted hover:text-default flex items-center gap-1"},[v(u(e.value)+" ",1),d(i,{name:"i-carbon-launch",class:"text-xs"})],8,q)):(t(),n("span",{key:3,class:_(["devtools-kv-value flex items-center gap-1.5",{"font-mono":e.mono!==!1,"text-green-500":e.value===!0,"text-red-400":e.value===!1,"text-muted italic":e.value===void 0||e.value===""}])},[c(e)?(t(),n("span",{key:0,class:"inline-block w-3 h-3 rounded-sm shrink-0 border border-[var(--ui-border)]",style:O({background:String(e.value).trim()})},null,4)):k("",!0),v(" "+u(e.value===void 0||e.value===""?"(empty)":e.value),1)],2)),!e.code&&e.copyable&&e.value!==void 0&&e.value!==""?(t(),x(C,{key:4,text:String(e.value),class:"opacity-0 group-hover:opacity-100 transition-opacity"},null,8,["text"])):k("",!0)],2)],2))),128))])}}}),P=Object.assign(b(H,[["__scopeId","data-v-983967b4"]]),{__name:"DevtoolsKeyValue"});export{A as _,P as a};
@@ -0,0 +1 @@
1
+ import{_ as I}from"./GDfpgsTy.js";import{_ as M,i as y,d as i,g as p,f as T,a as C,n as D,h as U,c as G,j as H}from"./DAKdquko.js";import{G as q,aH as J,aa as a,x as r,t as o,a5 as k,u as f,k as L,v as g,ag as N,B as c,aj as m,a2 as E,i as F,ap as e,aR as h,b as R,af as B,C as x,n as K,s as w,ai as Q}from"./DsxXb4gA.js";import{_ as W}from"./ChL3K-7X.js";import{_ as X}from"./2R9QS7Fj.js";const Y=["open"],Z={class:"flex-1 min-w-0"},ee={class:"text-sm font-semibold"},te={key:0,class:"text-xs text-muted mt-0.5"},se=q({__name:"DevtoolsSection",props:E({icon:{},text:{},description:{},collapse:{type:Boolean,default:!0},padding:{type:Boolean,default:!0}},{open:{default:!0},openModifiers:{}}),emits:["update:open"],setup(d){const v=J(d,"open");function b(u){v.value=u.target.open}return(u,S)=>{const n=L;return a(),r("details",{open:v.value,class:"section-block",onToggle:b},[o("summary",{class:k(["section-header",d.collapse?"":"pointer-events-none"])},[o("div",{class:k(["section-title",v.value?"":"opacity-60"])},[d.icon?(a(),f(n,{key:0,name:d.icon,class:"text-lg text-muted shrink-0"},null,8,["name"])):g("",!0),o("div",Z,[o("div",ee,[N(u.$slots,"text",{},()=>[c(m(d.text),1)],!0)]),d.description||u.$slots.description?(a(),r("div",te,[N(u.$slots,"description",{},()=>[c(m(d.description),1)],!0)])):g("",!0)]),N(u.$slots,"actions",{},void 0,!0),d.collapse?(a(),f(n,{key:1,name:"i-carbon-chevron-down",class:"section-chevron text-muted"})):g("",!0)],2)],2),o("div",{class:k(d.padding?"p-3":"")},[N(u.$slots,"default",{},void 0,!0)],2)],40,Y)}}}),ae=Object.assign(F(se,[["__scopeId","data-v-4f7a0867"]]),{__name:"DevtoolsSection"}),oe={class:"space-y-4"},ne={class:"font-medium"},re={class:"flex items-center gap-2"},le={class:"font-medium text-sm"},ie={class:"text-xs text-muted mt-1 truncate"},ce={key:0,class:"space-y-4"},de={key:0},me={class:"space-y-0.5"},ue={class:"text-sm font-mono"},pe={key:0,class:"text-xs text-muted font-mono ml-auto truncate max-w-[200px]"},xe={class:"space-y-0.5 p-2"},fe={class:"text-sm font-mono"},ge={key:0,class:"text-xs text-muted font-mono ml-auto truncate max-w-[200px]"},_e={class:"flex gap-3 pt-2 border-t border-default"},he=["href"],ve=["href"],ye={class:"flex gap-3 justify-center pt-2"},ke={href:"https://validator.schema.org/",target:"_blank",rel:"noopener noreferrer",class:"text-xs text-muted hover:text-default flex items-center gap-1"},be={href:"https://search.google.com/test/rich-results",target:"_blank",rel:"noopener noreferrer",class:"text-xs text-muted hover:text-default flex items-center gap-1"},je=q({__name:"schema",setup(d){const v=w(()=>{const n=Q.value.tags.filter(t=>t.tag==="script"&&t.props?.type==="application/ld+json");if(!n.length)return null;for(const t of n)try{return JSON.parse(t.innerHTML||"{}")}catch{continue}return null}),b=w(()=>{const n=v.value;return n?n["@graph"]&&Array.isArray(n["@graph"])?n["@graph"].filter(t=>!t||typeof t!="object"||Object.keys(t).length===1&&t["@id"]?!1:!!t["@type"]):n["@type"]?[n]:[]:[]}),u=w(()=>b.value.filter(n=>H(i(n)))),S=w(()=>{let n=0,t=0;for(const j of u.value){const $=C(j);n+=$.missingRequired.length,t+=$.missingRecommended.length}return{errors:n,warnings:t}});return(n,t)=>{const j=I,$=M,_=L,O=K,V=ae,P=W,z=X;return a(),r("div",oe,[e(v)?(a(),r(R,{key:1},[e(S).errors>0?(a(),f($,{key:0,variant:"error"},{default:h(()=>[o("p",ne,m(e(S).errors)+" missing required propert"+m(e(S).errors>1?"ies":"y"),1)]),_:1})):g("",!0),(a(!0),r(R,null,B(e(b),(s,A)=>(a(),f(z,{key:A},{header:h(()=>[o("div",re,[x(_,{name:e(U)(e(i)(s)),class:"text-lg"},null,8,["name"]),o("span",le,m(e(i)(s)),1)]),o("p",ie,m(e(G)(s)),1)]),default:h(()=>[e(y)[e(i)(s)]?(a(),r("div",ce,[e(y)[e(i)(s)]?.required.length?(a(),r("div",de,[t[2]||(t[2]=o("div",{class:"text-xs font-semibold uppercase tracking-wider text-muted mb-2"}," Required ",-1)),o("div",me,[(a(!0),r(R,null,B(e(y)[e(i)(s)].required,l=>(a(),r("div",{key:l,class:"flex items-center gap-2 px-2 py-1.5 rounded-md"},[x(_,{name:e(p)(s,l)!==void 0?"i-carbon-checkmark-filled":"i-carbon-close-filled",class:k(["text-sm shrink-0",e(p)(s,l)!==void 0?"text-green-500":"text-red-400"])},null,8,["name","class"]),o("span",ue,m(l),1),e(p)(s,l)!==void 0?(a(),r("span",pe,m(e(T)(e(p)(s,l))),1)):(a(),f(O,{key:1,color:"error",variant:"subtle",size:"xs",class:"ml-auto"},{default:h(()=>[...t[1]||(t[1]=[c(" missing ",-1)])]),_:1}))]))),128))])])):g("",!0),e(y)[e(i)(s)]?.recommended.length?(a(),f(V,{key:1,open:!1,icon:"i-carbon-warning-filled",text:`Recommended (${e(C)(s).missingRecommended.length} missing)`,padding:!1},{default:h(()=>[o("div",xe,[(a(!0),r(R,null,B(e(y)[e(i)(s)].recommended,l=>(a(),r("div",{key:l,class:"flex items-center gap-2 px-2 py-1.5 rounded-md"},[x(_,{name:e(p)(s,l)!==void 0?"i-carbon-checkmark-filled":"i-carbon-warning-filled",class:k(["text-sm shrink-0",e(p)(s,l)!==void 0?"text-green-500":"text-amber-400"])},null,8,["name","class"]),o("span",fe,m(l),1),e(p)(s,l)!==void 0?(a(),r("span",ge,m(e(T)(e(p)(s,l))),1)):(a(),f(O,{key:1,color:"warning",variant:"subtle",size:"xs",class:"ml-auto"},{default:h(()=>[...t[3]||(t[3]=[c(" missing ",-1)])]),_:1}))]))),128))])]),_:2},1032,["text"])):g("",!0),o("div",_e,[o("a",{href:e(D)(e(i)(s)).schemaOrg,target:"_blank",rel:"noopener noreferrer",class:"text-xs text-muted hover:text-default flex items-center gap-1"},[x(_,{name:"i-carbon-launch",class:"text-xs"}),t[4]||(t[4]=c(" Schema.org ",-1))],8,he),e(D)(e(i)(s)).googlePage?(a(),r("a",{key:0,href:e(D)(e(i)(s)).googlePage,target:"_blank",rel:"noopener noreferrer",class:"text-xs text-muted hover:text-default flex items-center gap-1"},[x(_,{name:"i-carbon-launch",class:"text-xs"}),t[5]||(t[5]=c(" Google Docs ",-1))],8,ve)):g("",!0)])])):g("",!0),o("div",{class:k(["max-h-[400px] overflow-auto",{"mt-4 pt-4 border-t border-default":e(y)[e(i)(s)]}])},[x(P,{code:JSON.stringify(s,null,2),lang:"json"},null,8,["code"])],2)]),_:2},1024))),128)),o("div",ye,[o("a",ke,[x(_,{name:"i-carbon-launch",class:"text-xs"}),t[6]||(t[6]=c(" Schema.org Validator ",-1))]),o("a",be,[x(_,{name:"i-carbon-launch",class:"text-xs"}),t[7]||(t[7]=c(" Google Rich Results Test ",-1))])])],64)):(a(),f(j,{key:0,icon:"i-carbon-chart-relationship",title:"No structured data detected"},{description:h(()=>[...t[0]||(t[0]=[c(" Add JSON-LD structured data via ",-1),o("code",{class:"bg-elevated px-1.5 py-0.5 rounded text-xs"},"useSchemaOrg()",-1),c(" or ",-1),o("code",{class:"bg-elevated px-1.5 py-0.5 rounded text-xs"},"useHead()",-1),c(" with a script tag. ",-1)])]),_:1}))])}}});export{je as default};
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__unhead/_nuxt/entry.clcQIxBm.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/DVtdvxJ7.js"><script type="module" src="/__unhead/_nuxt/DVtdvxJ7.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__unhead/",buildId:"35b427b0-d95c-4e8c-ba8f-41688b3cc0a3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776871536684,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__unhead/_nuxt/entry.BIq0UsGv.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/DsxXb4gA.js"><script type="module" src="/__unhead/_nuxt/DsxXb4gA.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__unhead/",buildId:"131284c6-b351-4ba5-8ac9-6320fa409f91",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1779859459057,false]</script></body></html>
@@ -0,0 +1,72 @@
1
+ import { UnpluginInstance } from 'unplugin';
2
+ import { Plugin } from 'vite';
3
+ import { V as VitePluginOptions } from './shared/bundler.LjD9SWtb.mjs';
4
+
5
+ /**
6
+ * Per-framework factory config. `framework` is the package name (e.g.
7
+ * `@unhead/vue`) used internally by the base bundler to import runtime
8
+ * plugins from the right path; `streamingPlugin` is the framework's
9
+ * streaming unplugin instance (as returned by `createUnplugin`).
10
+ */
11
+ interface FrameworkPluginConfig<S> {
12
+ framework: string;
13
+ streamingPlugin: UnpluginInstance<S | undefined, boolean>;
14
+ }
15
+ interface UnheadFrameworkOptions<S> extends VitePluginOptions {
16
+ /** Enable streaming SSR support. */
17
+ streaming?: true | S | false;
18
+ /**
19
+ * Inject the runtime `ValidatePlugin`. **Vite-only**: ignored by `.webpack()`,
20
+ * `.rspack()`, and `.rollup()` because injection happens via the Vite
21
+ * `CreateHeadTransform` plugin, which has no equivalent on other bundlers.
22
+ */
23
+ validate?: VitePluginOptions['validate'];
24
+ /**
25
+ * Enable the Vite Devtools integration. **Vite-only**: ignored by `.webpack()`,
26
+ * `.rspack()`, and `.rollup()` since `unheadDevtools` depends on
27
+ * `@vitejs/devtools-kit`.
28
+ */
29
+ devtools?: VitePluginOptions['devtools'];
30
+ }
31
+ /**
32
+ * Shape returned by the unified framework factory. Mirrors the subset of
33
+ * `UnpluginInstance` methods that Nuxt's `addBuildPlugin` consumes, so a
34
+ * call site can forward the factory object directly.
35
+ *
36
+ * Note: `rollup()` is provided for completeness (e.g. SSG static builds)
37
+ * but does **not** detect SSR context. `SSRStaticReplace` always sees
38
+ * `ssr=false` here because rollup has no equivalent of vite's
39
+ * `env.isSsrBuild` or webpack's `compiler.options.name === 'server'` hook;
40
+ * `head.ssr` references will always be statically rewritten to `false`.
41
+ * Use `.vite()` or `.webpack()` for SSR builds.
42
+ */
43
+ interface UnheadBundlerFactory {
44
+ vite: () => Plugin[];
45
+ webpack: () => any[];
46
+ rspack: () => any[];
47
+ rollup: () => any[];
48
+ }
49
+ /**
50
+ * Unified framework factory. Returns an object with per-bundler dispatch
51
+ * methods so consumers (e.g. Nuxt's `addBuildPlugin`) can forward it
52
+ * directly without per-bundler imports.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * // framework-side:
57
+ * export const Unhead = createFrameworkPlugin({
58
+ * framework: '@unhead/vue',
59
+ * streamingPlugin: unheadVueStreamingPlugin,
60
+ * })
61
+ *
62
+ * // consumer-side (vite):
63
+ * plugins: [...Unhead({ streaming: true }).vite()]
64
+ *
65
+ * // consumer-side (nuxt kit):
66
+ * addBuildPlugin(Unhead({ streaming: true }))
67
+ * ```
68
+ */
69
+ declare function createFrameworkPlugin<S>({ framework, streamingPlugin }: FrameworkPluginConfig<S>): (options?: UnheadFrameworkOptions<S>) => UnheadBundlerFactory;
70
+
71
+ export { createFrameworkPlugin };
72
+ export type { FrameworkPluginConfig, UnheadBundlerFactory, UnheadFrameworkOptions };
@@ -0,0 +1,72 @@
1
+ import { UnpluginInstance } from 'unplugin';
2
+ import { Plugin } from 'vite';
3
+ import { V as VitePluginOptions } from './shared/bundler.LjD9SWtb.js';
4
+
5
+ /**
6
+ * Per-framework factory config. `framework` is the package name (e.g.
7
+ * `@unhead/vue`) used internally by the base bundler to import runtime
8
+ * plugins from the right path; `streamingPlugin` is the framework's
9
+ * streaming unplugin instance (as returned by `createUnplugin`).
10
+ */
11
+ interface FrameworkPluginConfig<S> {
12
+ framework: string;
13
+ streamingPlugin: UnpluginInstance<S | undefined, boolean>;
14
+ }
15
+ interface UnheadFrameworkOptions<S> extends VitePluginOptions {
16
+ /** Enable streaming SSR support. */
17
+ streaming?: true | S | false;
18
+ /**
19
+ * Inject the runtime `ValidatePlugin`. **Vite-only**: ignored by `.webpack()`,
20
+ * `.rspack()`, and `.rollup()` because injection happens via the Vite
21
+ * `CreateHeadTransform` plugin, which has no equivalent on other bundlers.
22
+ */
23
+ validate?: VitePluginOptions['validate'];
24
+ /**
25
+ * Enable the Vite Devtools integration. **Vite-only**: ignored by `.webpack()`,
26
+ * `.rspack()`, and `.rollup()` since `unheadDevtools` depends on
27
+ * `@vitejs/devtools-kit`.
28
+ */
29
+ devtools?: VitePluginOptions['devtools'];
30
+ }
31
+ /**
32
+ * Shape returned by the unified framework factory. Mirrors the subset of
33
+ * `UnpluginInstance` methods that Nuxt's `addBuildPlugin` consumes, so a
34
+ * call site can forward the factory object directly.
35
+ *
36
+ * Note: `rollup()` is provided for completeness (e.g. SSG static builds)
37
+ * but does **not** detect SSR context. `SSRStaticReplace` always sees
38
+ * `ssr=false` here because rollup has no equivalent of vite's
39
+ * `env.isSsrBuild` or webpack's `compiler.options.name === 'server'` hook;
40
+ * `head.ssr` references will always be statically rewritten to `false`.
41
+ * Use `.vite()` or `.webpack()` for SSR builds.
42
+ */
43
+ interface UnheadBundlerFactory {
44
+ vite: () => Plugin[];
45
+ webpack: () => any[];
46
+ rspack: () => any[];
47
+ rollup: () => any[];
48
+ }
49
+ /**
50
+ * Unified framework factory. Returns an object with per-bundler dispatch
51
+ * methods so consumers (e.g. Nuxt's `addBuildPlugin`) can forward it
52
+ * directly without per-bundler imports.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * // framework-side:
57
+ * export const Unhead = createFrameworkPlugin({
58
+ * framework: '@unhead/vue',
59
+ * streamingPlugin: unheadVueStreamingPlugin,
60
+ * })
61
+ *
62
+ * // consumer-side (vite):
63
+ * plugins: [...Unhead({ streaming: true }).vite()]
64
+ *
65
+ * // consumer-side (nuxt kit):
66
+ * addBuildPlugin(Unhead({ streaming: true }))
67
+ * ```
68
+ */
69
+ declare function createFrameworkPlugin<S>({ framework, streamingPlugin }: FrameworkPluginConfig<S>): (options?: UnheadFrameworkOptions<S>) => UnheadBundlerFactory;
70
+
71
+ export { createFrameworkPlugin };
72
+ export type { FrameworkPluginConfig, UnheadBundlerFactory, UnheadFrameworkOptions };
@@ -0,0 +1,102 @@
1
+ import { S as SSRStaticReplace, u as unheadDevtools, C as CreateHeadTransform, T as TreeshakeServerComposables, U as UseSeoMetaTransform, M as MinifyTransform, c as createHeadTransformContext } from './shared/bundler.D9eYJXZg.mjs';
2
+ import 'node:fs';
3
+ import 'node:path';
4
+ import 'node:url';
5
+ import 'magic-string';
6
+ import 'oxc-walker';
7
+ import '@vitejs/devtools-kit';
8
+ import 'oxc-parser';
9
+ import 'ufo';
10
+ import 'unplugin';
11
+ import 'node:vm';
12
+ import 'unhead/utils';
13
+
14
+ function resolveCoreDefs(options) {
15
+ const defs = [];
16
+ const common = { filter: options.filter, sourcemap: options.sourcemap };
17
+ if (options.treeshake !== false) {
18
+ const treeshakeOpts = typeof options.treeshake === "object" ? options.treeshake : {};
19
+ defs.push({ instance: TreeshakeServerComposables, options: { ...common, ...treeshakeOpts } });
20
+ }
21
+ if (options.transformSeoMeta !== false) {
22
+ const seoMetaOpts = typeof options.transformSeoMeta === "object" ? options.transformSeoMeta : {};
23
+ defs.push({ instance: UseSeoMetaTransform, options: { ...common, ...seoMetaOpts } });
24
+ }
25
+ if (options.minify !== false) {
26
+ const minifyOpts = typeof options.minify === "object" ? options.minify : options.minify === true ? { js: true, css: true } : {};
27
+ if (minifyOpts.js || minifyOpts.css) {
28
+ defs.push({ instance: MinifyTransform, options: { ...common, ...minifyOpts } });
29
+ }
30
+ }
31
+ return defs;
32
+ }
33
+ function dispatch(bundler, defs) {
34
+ const out = [];
35
+ for (const { instance, options } of defs) {
36
+ const plugin = instance[bundler](options);
37
+ if (Array.isArray(plugin))
38
+ out.push(...plugin);
39
+ else out.push(plugin);
40
+ }
41
+ return out;
42
+ }
43
+ function resolveStreamingOpts(streaming) {
44
+ return streaming && typeof streaming === "object" ? streaming : void 0;
45
+ }
46
+ function pushPlugin(out, value) {
47
+ if (Array.isArray(value))
48
+ out.push(...value);
49
+ else out.push(value);
50
+ }
51
+ function createFrameworkPlugin({ framework, streamingPlugin }) {
52
+ return (options = {}) => {
53
+ const { streaming, validate, devtools, ...coreOpts } = options;
54
+ const defs = resolveCoreDefs(coreOpts);
55
+ const streamOpts = resolveStreamingOpts(streaming);
56
+ const wantStreaming = !!streaming;
57
+ return {
58
+ vite: () => {
59
+ const plugins = dispatch("vite", defs);
60
+ const ctx = createHeadTransformContext();
61
+ if (validate !== false) {
62
+ ctx.addRuntimePlugin({
63
+ import: { name: "ValidatePlugin", source: `${framework}/plugins`, as: "__unhead_validate" },
64
+ client: "_h.use(__unhead_validate({ root: __ROOT__ }))"
65
+ });
66
+ }
67
+ if (devtools !== false) {
68
+ const devtoolsOpts = typeof devtools === "object" ? devtools : {};
69
+ plugins.push(unheadDevtools({ ...devtoolsOpts, _ctx: ctx }));
70
+ }
71
+ plugins.push(SSRStaticReplace.vite({}));
72
+ plugins.push(CreateHeadTransform(ctx));
73
+ if (wantStreaming)
74
+ pushPlugin(plugins, streamingPlugin.vite(streamOpts));
75
+ return plugins;
76
+ },
77
+ webpack: () => {
78
+ const plugins = dispatch("webpack", defs);
79
+ plugins.push(SSRStaticReplace.webpack({}));
80
+ if (wantStreaming)
81
+ pushPlugin(plugins, streamingPlugin.webpack(streamOpts));
82
+ return plugins;
83
+ },
84
+ rspack: () => {
85
+ const plugins = dispatch("rspack", defs);
86
+ plugins.push(SSRStaticReplace.rspack({}));
87
+ if (wantStreaming)
88
+ pushPlugin(plugins, streamingPlugin.rspack(streamOpts));
89
+ return plugins;
90
+ },
91
+ rollup: () => {
92
+ const plugins = dispatch("rollup", defs);
93
+ plugins.push(SSRStaticReplace.rollup({}));
94
+ if (wantStreaming)
95
+ pushPlugin(plugins, streamingPlugin.rollup(streamOpts));
96
+ return plugins;
97
+ }
98
+ };
99
+ };
100
+ }
101
+
102
+ export { createFrameworkPlugin };
@@ -1,4 +1,4 @@
1
- import { M as MinifyFn } from '../shared/bundler.BwKIGaKX.mjs';
1
+ import { M as MinifyFn } from '../shared/bundler.LjD9SWtb.mjs';
2
2
 
3
3
  declare function createJSMinifier(): MinifyFn;
4
4
 
@@ -1,4 +1,4 @@
1
- import { M as MinifyFn } from '../shared/bundler.BwKIGaKX.js';
1
+ import { M as MinifyFn } from '../shared/bundler.LjD9SWtb.js';
2
2
 
3
3
  declare function createJSMinifier(): MinifyFn;
4
4
 
@@ -1,4 +1,4 @@
1
- import { M as MinifyFn } from '../shared/bundler.BwKIGaKX.mjs';
1
+ import { M as MinifyFn } from '../shared/bundler.LjD9SWtb.mjs';
2
2
 
3
3
  declare function createCSSMinifier(): MinifyFn;
4
4
 
@@ -1,4 +1,4 @@
1
- import { M as MinifyFn } from '../shared/bundler.BwKIGaKX.js';
1
+ import { M as MinifyFn } from '../shared/bundler.LjD9SWtb.js';
2
2
 
3
3
  declare function createCSSMinifier(): MinifyFn;
4
4
 
@@ -1,4 +1,4 @@
1
- import { M as MinifyFn } from '../shared/bundler.BwKIGaKX.mjs';
1
+ import { M as MinifyFn } from '../shared/bundler.LjD9SWtb.mjs';
2
2
 
3
3
  declare function createJSMinifier(): MinifyFn;
4
4
 
@@ -1,4 +1,4 @@
1
- import { M as MinifyFn } from '../shared/bundler.BwKIGaKX.js';
1
+ import { M as MinifyFn } from '../shared/bundler.LjD9SWtb.js';
2
2
 
3
3
  declare function createJSMinifier(): MinifyFn;
4
4
 
@@ -1,12 +1,321 @@
1
- import { pathToFileURL } from 'node:url';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { relative, resolve } from 'node:path';
3
+ import { fileURLToPath, pathToFileURL } from 'node:url';
2
4
  import MagicString from 'magic-string';
5
+ import { parseAndWalk, ScopeTracker, walk, ScopeTrackerImport } from 'oxc-walker';
6
+ import { defineRpcFunction } from '@vitejs/devtools-kit';
3
7
  import { parseSync } from 'oxc-parser';
4
- import { ScopeTracker, walk, ScopeTrackerImport } from 'oxc-walker';
5
8
  import { parseURL, parseQuery } from 'ufo';
6
9
  import { createUnplugin } from 'unplugin';
7
10
  import { createContext, runInContext } from 'node:vm';
8
11
  import { resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue } from 'unhead/utils';
9
12
 
13
+ const getConfigRpc = defineRpcFunction({
14
+ name: "unhead:get-config",
15
+ type: "static",
16
+ setup: (ctx) => ({
17
+ handler: () => ({
18
+ cwd: ctx.cwd,
19
+ mode: ctx.mode
20
+ })
21
+ })
22
+ });
23
+
24
+ async function tryRequire() {
25
+ try {
26
+ const mod = await import('@unhead/cli');
27
+ return { runLint: mod.runLint };
28
+ } catch {
29
+ return null;
30
+ }
31
+ }
32
+ const runLintRpc = defineRpcFunction({
33
+ name: "unhead:run-lint",
34
+ type: "static",
35
+ setup: (ctx) => ({
36
+ handler: async (args = {}) => {
37
+ const lib = await tryRequire();
38
+ if (!lib) {
39
+ return {
40
+ available: false,
41
+ message: "Install @unhead/cli (and eslint as a peer) to enable in-devtools auditing."
42
+ };
43
+ }
44
+ const start = Date.now();
45
+ const mode = args.mode === "migrate" ? "migrate" : "audit";
46
+ const cwd = ctx.cwd;
47
+ const { results, errorCount, warningCount, fixableErrorCount, fixableWarningCount } = await lib.runLint({
48
+ patterns: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx,vue,svelte}"],
49
+ mode,
50
+ cwd,
51
+ ignore: ["**/node_modules/**", "**/dist/**", "**/.output/**", "**/.nuxt/**"]
52
+ });
53
+ const files = results.map((r) => ({
54
+ filePath: r.filePath,
55
+ relativePath: relative(cwd, r.filePath),
56
+ errorCount: r.errorCount,
57
+ warningCount: r.warningCount,
58
+ fixableErrorCount: r.fixableErrorCount,
59
+ fixableWarningCount: r.fixableWarningCount,
60
+ fixed: typeof r.output === "string",
61
+ messages: (r.messages || []).map((m) => ({
62
+ ruleId: m.ruleId ?? null,
63
+ message: m.message,
64
+ severity: m.severity === 2 ? "error" : "warn",
65
+ line: m.line,
66
+ column: m.column,
67
+ endLine: m.endLine,
68
+ endColumn: m.endColumn,
69
+ // Only `fix` is auto-applied by `--fix`; suggestions are editor-only.
70
+ fixable: Boolean(m.fix)
71
+ }))
72
+ })).filter((f) => f.errorCount > 0 || f.warningCount > 0 || f.fixed);
73
+ const filesFixed = files.filter((f) => f.fixed).length;
74
+ return {
75
+ available: true,
76
+ mode,
77
+ files,
78
+ errorCount,
79
+ warningCount,
80
+ fixableErrorCount,
81
+ fixableWarningCount,
82
+ filesFixed,
83
+ durationMs: Date.now() - start
84
+ };
85
+ }
86
+ })
87
+ });
88
+
89
+ const HEAD_COMPOSABLES = ["useHead", "useSeoMeta", "useHeadSafe", "useScript"];
90
+ const FILE_RE$1 = /\.(vue|tsx?|jsx?|svelte)$/;
91
+ const LEADING_SLASH_RE = /^\//;
92
+ const UNHEAD_VERSION_RE = /__UNHEAD_VERSION__ = ['"]'?["']/;
93
+ const UNHEAD_ICON = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23FBBF24'/%3E%3Cstop offset='100%25' stop-color='%23f0db4f'/%3E%3C/linearGradient%3E%3Cmask id='m'%3E%3Crect width='100%25' height='100%25' fill='white'/%3E%3Cpath d='M12 32 L1 32 L15 15 Z' fill='black'/%3E%3C/mask%3E%3C/defs%3E%3Cpath fill='none' stroke='url(%23g)' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 4v14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4' mask='url(%23m)'/%3E%3C/svg%3E`;
94
+ const DEVTOOLS_UI_ROUTE = "/__unhead/";
95
+ function transformSourceLocations(code, id, root) {
96
+ if (!HEAD_COMPOSABLES.some((c) => code.includes(c)))
97
+ return;
98
+ const s = new MagicString(code);
99
+ let transformed = false;
100
+ const relativePath = id.startsWith(root) ? id.slice(root.length).replace(LEADING_SLASH_RE, "") : id;
101
+ parseAndWalk(code, id, {
102
+ parseOptions: { lang: "ts" },
103
+ enter(node) {
104
+ if (node.type !== "CallExpression")
105
+ return;
106
+ const callee = node.callee;
107
+ if (!callee)
108
+ return;
109
+ const name = callee.type === "Identifier" ? callee.name : callee.type === "MemberExpression" && callee.property?.type === "Identifier" ? callee.property.name : null;
110
+ if (!name || !HEAD_COMPOSABLES.includes(name))
111
+ return;
112
+ const args = node.arguments;
113
+ if (!args || args.length === 0)
114
+ return;
115
+ const lineNumber = code.slice(0, node.start).split("\n").length;
116
+ const sourceValue = `${relativePath}:${lineNumber}`;
117
+ if (args.length === 1) {
118
+ const argEnd = args[0].end;
119
+ s.appendRight(argEnd, `, { _source: ${JSON.stringify(sourceValue)} }`);
120
+ transformed = true;
121
+ } else if (args.length >= 2 && args[1].type === "ObjectExpression") {
122
+ const objStart = args[1].start + 1;
123
+ s.appendRight(objStart, ` _source: ${JSON.stringify(sourceValue)},`);
124
+ transformed = true;
125
+ }
126
+ }
127
+ });
128
+ if (!transformed)
129
+ return;
130
+ return {
131
+ code: s.toString(),
132
+ map: s.generateMap({ includeContent: true, source: id })
133
+ };
134
+ }
135
+ function unheadDevtools(options) {
136
+ let root = "";
137
+ let enabled = false;
138
+ let bridgeCode;
139
+ let unheadVersion = "";
140
+ const pkgDir = fileURLToPath(new URL("..", import.meta.url));
141
+ const devtoolsUiDir = fileURLToPath(new URL("./devtools-ui", import.meta.url));
142
+ return {
143
+ name: "@unhead/devtools",
144
+ apply: "serve",
145
+ configResolved(config) {
146
+ root = config.root;
147
+ enabled = config.plugins.some((p) => p.name?.startsWith("vite:devtools"));
148
+ if (!enabled)
149
+ return;
150
+ if (options?._ctx) {
151
+ options._ctx.addRuntimePlugin({
152
+ import: { name: "devtoolsPlugin", source: "@unhead/bundler", as: "__unhead_devtoolsPlugin" },
153
+ client: "window.__unhead_devtools__=_h",
154
+ server: "_h.use(__unhead_devtoolsPlugin())"
155
+ });
156
+ }
157
+ try {
158
+ const unheadPkg = resolve(pkgDir, "node_modules/unhead/package.json");
159
+ if (existsSync(unheadPkg))
160
+ unheadVersion = JSON.parse(readFileSync(unheadPkg, "utf-8")).version || "";
161
+ } catch {
162
+ }
163
+ const bridgePath = resolve(pkgDir, "dist/devtools/bridge.mjs");
164
+ if (existsSync(bridgePath))
165
+ bridgeCode = readFileSync(bridgePath, "utf-8");
166
+ },
167
+ configureServer(server) {
168
+ if (!enabled)
169
+ return;
170
+ server.middlewares.use("/@unhead/bridge.mjs", async (_req, res) => {
171
+ const result = await server.transformRequest("/@unhead/bridge.mjs");
172
+ res.setHeader("Content-Type", "application/javascript");
173
+ res.end(result?.code || 'console.warn("[unhead devtools] bridge not built")');
174
+ });
175
+ },
176
+ resolveId(id) {
177
+ if (!enabled)
178
+ return;
179
+ if (id === "/@unhead/bridge.mjs")
180
+ return id;
181
+ },
182
+ load(id) {
183
+ if (!enabled || id !== "/@unhead/bridge.mjs")
184
+ return;
185
+ if (!bridgeCode)
186
+ return 'console.warn("[unhead devtools] bridge not built")';
187
+ let code = bridgeCode;
188
+ if (unheadVersion)
189
+ code = code.replace(UNHEAD_VERSION_RE, `__UNHEAD_VERSION__ = '${unheadVersion}'`);
190
+ const kitClientPath = resolve(pkgDir, "node_modules/@vitejs/devtools-kit/dist/client.js");
191
+ if (existsSync(kitClientPath))
192
+ return code.replace(`'@vitejs/devtools-kit/client'`, `'${kitClientPath}'`);
193
+ return code;
194
+ },
195
+ transform: {
196
+ filter: { id: FILE_RE$1 },
197
+ handler(code, id) {
198
+ if (!enabled)
199
+ return;
200
+ return transformSourceLocations(code, id, root);
201
+ }
202
+ },
203
+ transformIndexHtml: {
204
+ // Run before non-pre HTML transforms so the injected module import
205
+ // goes through the full Vite plugin pipeline.
206
+ order: "pre",
207
+ handler() {
208
+ if (!enabled)
209
+ return [];
210
+ return [{
211
+ tag: "script",
212
+ attrs: { type: "module" },
213
+ children: `import("/@unhead/bridge.mjs")`,
214
+ injectTo: "head"
215
+ }];
216
+ }
217
+ },
218
+ devtools: {
219
+ setup(ctx) {
220
+ if (existsSync(devtoolsUiDir)) {
221
+ ctx.views.hostStatic(DEVTOOLS_UI_ROUTE, devtoolsUiDir);
222
+ }
223
+ ctx.docks.register({
224
+ id: "unhead",
225
+ title: "Unhead",
226
+ icon: UNHEAD_ICON,
227
+ type: "iframe",
228
+ url: DEVTOOLS_UI_ROUTE
229
+ });
230
+ ctx.rpc.register(getConfigRpc);
231
+ ctx.rpc.register(runLintRpc);
232
+ }
233
+ }
234
+ };
235
+ }
236
+
237
+ const FILE_RE = /\.(vue|tsx?|jsx?|svelte)$/;
238
+ const UNHEAD_SOURCE_RE = /^(?:@unhead\/[^/]+|unhead)(?:\/[^?]*)?$/;
239
+ function createHeadTransformContext() {
240
+ const registrations = [];
241
+ return {
242
+ addRuntimePlugin(reg) {
243
+ registrations.push(reg);
244
+ },
245
+ getRegistrations() {
246
+ return registrations;
247
+ }
248
+ };
249
+ }
250
+ function CreateHeadTransform(ctx) {
251
+ let root = "";
252
+ return {
253
+ name: "@unhead/create-head-transform",
254
+ apply: "serve",
255
+ configResolved(config) {
256
+ root = config.root;
257
+ },
258
+ transform: {
259
+ filter: { id: FILE_RE },
260
+ handler(code, id) {
261
+ const registrations = ctx.getRegistrations();
262
+ if (!registrations.length)
263
+ return;
264
+ if (!code.includes("createHead"))
265
+ return;
266
+ const isServer = this.environment?.config?.consumer === "server";
267
+ const envRegistrations = registrations.filter((r) => isServer ? r.server : r.client);
268
+ if (!envRegistrations.length)
269
+ return;
270
+ const s = new MagicString(code);
271
+ let transformed = false;
272
+ const directCreateHeadNames = /* @__PURE__ */ new Set();
273
+ const namespaceNames = /* @__PURE__ */ new Set();
274
+ parseAndWalk(code, id, {
275
+ parseOptions: { lang: "ts" },
276
+ enter(node) {
277
+ if (node.type === "ImportDeclaration") {
278
+ const source = node.source?.value;
279
+ if (typeof source !== "string" || !UNHEAD_SOURCE_RE.test(source))
280
+ return;
281
+ for (const spec of node.specifiers || []) {
282
+ if (spec.type === "ImportSpecifier" && spec.imported?.name === "createHead")
283
+ directCreateHeadNames.add(spec.local.name);
284
+ else if (spec.type === "ImportNamespaceSpecifier")
285
+ namespaceNames.add(spec.local.name);
286
+ }
287
+ return;
288
+ }
289
+ if (node.type !== "CallExpression")
290
+ return;
291
+ const callee = node.callee;
292
+ if (!callee)
293
+ return;
294
+ const isDirect = callee.type === "Identifier" && directCreateHeadNames.has(callee.name);
295
+ const isNamespaced = callee.type === "MemberExpression" && callee.object?.type === "Identifier" && namespaceNames.has(callee.object.name) && callee.property?.type === "Identifier" && callee.property.name === "createHead";
296
+ if (!isDirect && !isNamespaced)
297
+ return;
298
+ const statements = envRegistrations.map((r) => (isServer ? r.server : r.client).replace(/__ROOT__/g, JSON.stringify(root))).join(",");
299
+ s.prependLeft(node.start, `((_h)=>(${statements},_h))(`);
300
+ s.appendRight(node.end, `)`);
301
+ transformed = true;
302
+ }
303
+ });
304
+ if (!transformed)
305
+ return;
306
+ for (const reg of envRegistrations) {
307
+ s.prepend(`import { ${reg.import.name} as ${reg.import.as} } from '${reg.import.source}';
308
+ `);
309
+ }
310
+ return {
311
+ code: s.toString(),
312
+ map: s.generateMap({ includeContent: true, source: id })
313
+ };
314
+ }
315
+ }
316
+ };
317
+ }
318
+
10
319
  const NODE_MODULES_RE$2 = /[\\/]node_modules[\\/]/;
11
320
  const TRANSFORM_RE$2 = /\.(?:(?:c|m)?j|t)sx?$/;
12
321
  const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
@@ -463,4 +772,4 @@ const UseSeoMetaTransform = createUnplugin((options = {}) => {
463
772
  };
464
773
  });
465
774
 
466
- export { MinifyTransform as M, SSRStaticReplace as S, TreeshakeServerComposables as T, UseSeoMetaTransform as U };
775
+ export { CreateHeadTransform as C, MinifyTransform as M, SSRStaticReplace as S, TreeshakeServerComposables as T, UseSeoMetaTransform as U, createHeadTransformContext as c, unheadDevtools as u };