@unhead/bundler 3.1.2 → 3.1.3

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.
@@ -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.DJWUBWwc.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/CadLYmKg.js"><script type="module" src="/__unhead/_nuxt/CadLYmKg.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:"04bb073f-4d60-4967-9ccb-11e682796ae3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780638734437,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.DJWUBWwc.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/CadLYmKg.js"><script type="module" src="/__unhead/_nuxt/CadLYmKg.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:"1819831b-dbfb-42f9-900b-14e48a657a07",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780641145943,false]</script></body></html>
@@ -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.DJWUBWwc.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/CadLYmKg.js"><script type="module" src="/__unhead/_nuxt/CadLYmKg.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:"04bb073f-4d60-4967-9ccb-11e682796ae3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780638734437,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.DJWUBWwc.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/CadLYmKg.js"><script type="module" src="/__unhead/_nuxt/CadLYmKg.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:"1819831b-dbfb-42f9-900b-14e48a657a07",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780641145943,false]</script></body></html>
@@ -1 +1 @@
1
- {"id":"04bb073f-4d60-4967-9ccb-11e682796ae3","timestamp":1780638725304}
1
+ {"id":"1819831b-dbfb-42f9-900b-14e48a657a07","timestamp":1780641136609}
@@ -0,0 +1 @@
1
+ {"id":"1819831b-dbfb-42f9-900b-14e48a657a07","timestamp":1780641136609,"prerendered":[]}
@@ -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.DJWUBWwc.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/CadLYmKg.js"><script type="module" src="/__unhead/_nuxt/CadLYmKg.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:"04bb073f-4d60-4967-9ccb-11e682796ae3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780638734437,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.DJWUBWwc.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__unhead/_nuxt/CadLYmKg.js"><script type="module" src="/__unhead/_nuxt/CadLYmKg.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:"1819831b-dbfb-42f9-900b-14e48a657a07",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1780641145943,false]</script></body></html>
@@ -1,5 +1,6 @@
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';
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.BEzA8ILR.mjs';
2
2
  import 'node:fs';
3
+ import 'node:module';
3
4
  import 'node:path';
4
5
  import 'node:url';
5
6
  import 'magic-string';
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
- import { relative, resolve } from 'node:path';
3
- import { fileURLToPath, pathToFileURL } from 'node:url';
2
+ import { createRequire } from 'node:module';
3
+ import { relative, resolve, dirname } from 'node:path';
4
+ import { pathToFileURL, fileURLToPath } from 'node:url';
4
5
  import MagicString from 'magic-string';
5
6
  import { parseAndWalk, ScopeTracker, walk, ScopeTrackerImport } from 'oxc-walker';
6
7
  import { defineRpcFunction } from '@vitejs/devtools-kit';
@@ -90,6 +91,15 @@ const HEAD_COMPOSABLES = ["useHead", "useSeoMeta", "useHeadSafe", "useScript"];
90
91
  const FILE_RE$1 = /\.(vue|tsx?|jsx?|svelte)$/;
91
92
  const LEADING_SLASH_RE = /^\//;
92
93
  const UNHEAD_VERSION_RE = /__UNHEAD_VERSION__ = ['"]'?["']/;
94
+ function findPkgRoot(fromUrl) {
95
+ let dir = dirname(fileURLToPath(fromUrl));
96
+ while (dir !== dirname(dir)) {
97
+ if (existsSync(resolve(dir, "package.json")))
98
+ return dir;
99
+ dir = dirname(dir);
100
+ }
101
+ return dir;
102
+ }
93
103
  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
104
  const DEVTOOLS_UI_ROUTE = "/__unhead/";
95
105
  function transformSourceLocations(code, id, root) {
@@ -137,8 +147,8 @@ function unheadDevtools(options) {
137
147
  let enabled = false;
138
148
  let bridgeCode;
139
149
  let unheadVersion = "";
140
- const pkgDir = fileURLToPath(new URL("..", import.meta.url));
141
- const devtoolsUiDir = fileURLToPath(new URL("./devtools-ui", import.meta.url));
150
+ const pkgDir = findPkgRoot(import.meta.url);
151
+ const devtoolsUiDir = resolve(pkgDir, "dist/devtools-ui");
142
152
  return {
143
153
  name: "@unhead/devtools",
144
154
  apply: "serve",
@@ -155,9 +165,9 @@ function unheadDevtools(options) {
155
165
  });
156
166
  }
157
167
  try {
158
- const unheadPkg = resolve(pkgDir, "node_modules/unhead/package.json");
159
- if (existsSync(unheadPkg))
160
- unheadVersion = JSON.parse(readFileSync(unheadPkg, "utf-8")).version || "";
168
+ const unheadEntry = createRequire(import.meta.url).resolve("unhead");
169
+ const unheadPkg = resolve(findPkgRoot(pathToFileURL(unheadEntry).href), "package.json");
170
+ unheadVersion = JSON.parse(readFileSync(unheadPkg, "utf-8")).version || "";
161
171
  } catch {
162
172
  }
163
173
  const bridgePath = resolve(pkgDir, "dist/devtools/bridge.mjs");
package/dist/vite.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { T as TreeshakeServerComposables, U as UseSeoMetaTransform, M as MinifyTransform, u as unheadDevtools, S as SSRStaticReplace, C as CreateHeadTransform, c as createHeadTransformContext } from './shared/bundler.D9eYJXZg.mjs';
1
+ import { T as TreeshakeServerComposables, U as UseSeoMetaTransform, M as MinifyTransform, u as unheadDevtools, S as SSRStaticReplace, C as CreateHeadTransform, c as createHeadTransformContext } from './shared/bundler.BEzA8ILR.mjs';
2
2
  import 'node:fs';
3
+ import 'node:module';
3
4
  import 'node:path';
4
5
  import 'node:url';
5
6
  import 'magic-string';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/bundler",
3
3
  "type": "module",
4
- "version": "3.1.2",
4
+ "version": "3.1.3",
5
5
  "description": "Unhead build-time optimizations for Vite and Webpack.",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -78,8 +78,8 @@
78
78
  "rolldown": ">=1.0.0-beta.0",
79
79
  "vite": ">=6.4.2",
80
80
  "webpack": ">=5.0.0",
81
- "@unhead/cli": "^3.1.2",
82
- "unhead": "^3.1.2"
81
+ "@unhead/cli": "^3.1.3",
82
+ "unhead": "^3.1.3"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "@unhead/cli": {
@@ -112,7 +112,7 @@
112
112
  "devDependencies": {
113
113
  "rollup": "^4.61.0",
114
114
  "vite": "^8.0.16",
115
- "unhead": "3.1.2"
115
+ "unhead": "3.1.3"
116
116
  },
117
117
  "scripts": {
118
118
  "build": "unbuild",
@@ -1 +0,0 @@
1
- {"id":"04bb073f-4d60-4967-9ccb-11e682796ae3","timestamp":1780638725304,"prerendered":[]}