nuxt-seo-utils 8.1.7 → 8.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1 -1
- package/dist/devtools/200.html +1 -1
- package/dist/devtools/404.html +1 -1
- package/dist/devtools/_nuxt/{D65AfcxY.js → BBOghfGa.js} +1 -1
- package/dist/devtools/_nuxt/BlLJGL5m.js +33 -0
- package/dist/devtools/_nuxt/{Cpq8TB1h.js → Ctlg7l5E.js} +1 -1
- package/dist/devtools/_nuxt/{Dw3QrPVs.js → CvqC5DcO.js} +1 -1
- package/dist/devtools/_nuxt/{B8ldmQbT.js → CyGZ_RcR.js} +1 -1
- package/dist/devtools/_nuxt/{BtSCtnKE.js → D7C0ZZvl.js} +1 -1
- package/dist/devtools/_nuxt/{CuJoTDlq.js → Da7LHUZj.js} +1 -1
- package/dist/devtools/_nuxt/DevtoolsMetric.B0IT7l09.css +1 -0
- package/dist/devtools/_nuxt/{DQME8n2D.js → J9qLxZN7.js} +1 -1
- package/dist/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/devtools/_nuxt/builds/meta/ec94f51b-9527-4bce-bb44-c3a921ddc064.json +1 -0
- package/dist/devtools/_nuxt/debug.B5eeYd8b.css +1 -0
- package/dist/devtools/_nuxt/{entry.DWTeHNJJ.css → entry.DZPkkv65.css} +1 -1
- package/dist/devtools/_nuxt/tools.ccu-C3wj.css +1 -0
- package/dist/devtools/debug/index.html +1 -1
- package/dist/devtools/docs/index.html +1 -1
- package/dist/devtools/identity/index.html +1 -1
- package/dist/devtools/index.html +1 -1
- package/dist/devtools/social/index.html +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +23 -64
- package/dist/runtime/app/logic/applyDefaults.js +9 -5
- package/dist/runtime/app/plugins/inferSeoMetaPlugin.js +1 -2
- package/dist/runtime/app/plugins/siteConfig.js +7 -5
- package/dist/runtime/server/plugins/minifyHtml.d.ts +2 -0
- package/dist/runtime/server/plugins/minifyHtml.js +51 -0
- package/package.json +19 -16
- package/dist/devtools/_nuxt/B1ufeY2h.js +0 -33
- package/dist/devtools/_nuxt/DevtoolsMetric.Cv74QUTK.css +0 -1
- package/dist/devtools/_nuxt/builds/meta/5ebe3307-aa80-4d5a-830a-ba421d526280.json +0 -1
- package/dist/devtools/_nuxt/debug.BmoxFpB4.css +0 -1
- package/dist/devtools/_nuxt/tools.BkwMltx0.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devtools-error[data-v-56b5a12f]{flex-direction:column;gap:.75rem;padding:3rem 1.5rem;text-align:center}.devtools-error[data-v-56b5a12f],.devtools-error-icon-wrap[data-v-56b5a12f]{align-items:center;display:flex;justify-content:center}.devtools-error-icon-wrap[data-v-56b5a12f]{background:#dc655f1a;border-radius:var(--radius-lg);height:3rem;width:3rem}.dark .devtools-error-icon-wrap[data-v-56b5a12f]{background:#843c3826}.devtools-error-icon[data-v-56b5a12f]{color:#d74745;font-size:1.5rem}.dark .devtools-error-icon[data-v-56b5a12f]{color:#ed756e}.devtools-error-title[data-v-56b5a12f]{color:var(--color-text);font-size:.875rem;font-weight:600}.devtools-error-message[data-v-56b5a12f]{color:var(--color-text-muted);font-size:.75rem;line-height:1.5;max-width:20rem}.devtools-error-actions[data-v-56b5a12f]{display:flex;gap:.5rem;margin-top:.25rem}.devtools-empty[data-v-1ef2fe3d]{align-items:center;display:flex;flex-direction:column;margin:0 auto;max-width:32rem;text-align:center}.devtools-empty-icon[data-v-1ef2fe3d]{align-items:center;border-radius:var(--radius-lg);display:inline-flex;height:4rem;justify-content:center;margin-bottom:1.5rem;width:4rem}.devtools-empty-icon-default[data-v-1ef2fe3d]{background:#11ad321f;color:var(--seo-green)}.dark .devtools-empty-icon-default[data-v-1ef2fe3d]{background:#11ad3226}.devtools-empty-icon-error[data-v-1ef2fe3d]{background:#cc272e1f;color:#cc272e}.dark .devtools-empty-icon-error[data-v-1ef2fe3d]{background:#cc272e26;color:#ff847d}.devtools-empty-title[data-v-1ef2fe3d]{color:var(--color-text);font-size:1.125rem;font-weight:600;margin-bottom:.75rem}@media(min-width:640px){.devtools-empty-title[data-v-1ef2fe3d]{font-size:1.25rem}}.devtools-empty-description[data-v-1ef2fe3d]{color:var(--color-text-muted);font-size:.875rem;line-height:1.5;margin-bottom:1.25rem}@media(min-width:640px){.devtools-empty-description[data-v-1ef2fe3d]{font-size:1rem}}.devtools-empty-actions[data-v-1ef2fe3d]{align-items:center;display:flex;flex-direction:column;gap:.75rem}
|
|
@@ -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="/__nuxt-seo-utils/_nuxt/entry.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-seo-utils/_nuxt/entry.DZPkkv65.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-seo-utils/_nuxt/BlLJGL5m.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BlLJGL5m.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:{i18n:{baseUrl:"",defaultLocale:"",rootRedirect:"",redirectStatusCode:302,skipSettingLocaleOnNavigate:false,locales:[],detectBrowserLanguage:{alwaysRedirect:false,cookieCrossOrigin:false,cookieDomain:"",cookieKey:"i18n_redirected",cookieSecure:false,fallbackLocale:"",redirectOn:"root",useCookie:true},experimental:{localeDetector:"",typedPages:true,typedOptionsAndMessages:false,alternateLinkCanonicalQueries:true,devCache:false,cacheLifetime:"",stripMessagesPayload:false,preload:false,strictSeo:false,nitroContextDetection:true,httpCacheDuration:10},domainLocales:{}}},app:{baseURL:"/__nuxt-seo-utils",buildId:"ec94f51b-9527-4bce-bb44-c3a921ddc064",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776312093330,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="/__nuxt-seo-utils/_nuxt/entry.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-seo-utils/_nuxt/entry.DZPkkv65.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-seo-utils/_nuxt/BlLJGL5m.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BlLJGL5m.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:{i18n:{baseUrl:"",defaultLocale:"",rootRedirect:"",redirectStatusCode:302,skipSettingLocaleOnNavigate:false,locales:[],detectBrowserLanguage:{alwaysRedirect:false,cookieCrossOrigin:false,cookieDomain:"",cookieKey:"i18n_redirected",cookieSecure:false,fallbackLocale:"",redirectOn:"root",useCookie:true},experimental:{localeDetector:"",typedPages:true,typedOptionsAndMessages:false,alternateLinkCanonicalQueries:true,devCache:false,cacheLifetime:"",stripMessagesPayload:false,preload:false,strictSeo:false,nitroContextDetection:true,httpCacheDuration:10},domainLocales:{}}},app:{baseURL:"/__nuxt-seo-utils",buildId:"ec94f51b-9527-4bce-bb44-c3a921ddc064",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776312093332,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="/__nuxt-seo-utils/_nuxt/entry.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-seo-utils/_nuxt/entry.DZPkkv65.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-seo-utils/_nuxt/BlLJGL5m.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BlLJGL5m.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:{i18n:{baseUrl:"",defaultLocale:"",rootRedirect:"",redirectStatusCode:302,skipSettingLocaleOnNavigate:false,locales:[],detectBrowserLanguage:{alwaysRedirect:false,cookieCrossOrigin:false,cookieDomain:"",cookieKey:"i18n_redirected",cookieSecure:false,fallbackLocale:"",redirectOn:"root",useCookie:true},experimental:{localeDetector:"",typedPages:true,typedOptionsAndMessages:false,alternateLinkCanonicalQueries:true,devCache:false,cacheLifetime:"",stripMessagesPayload:false,preload:false,strictSeo:false,nitroContextDetection:true,httpCacheDuration:10},domainLocales:{}}},app:{baseURL:"/__nuxt-seo-utils",buildId:"ec94f51b-9527-4bce-bb44-c3a921ddc064",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776312093332,false]</script></body></html>
|
package/dist/devtools/index.html
CHANGED
|
@@ -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="/__nuxt-seo-utils/_nuxt/entry.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-seo-utils/_nuxt/entry.DZPkkv65.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-seo-utils/_nuxt/BlLJGL5m.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BlLJGL5m.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_SITE_CONFIG__={_priority:{env:-15},env:"production"}</script><script>window.__NUXT__={};window.__NUXT__.config={public:{i18n:{baseUrl:"",defaultLocale:"",rootRedirect:"",redirectStatusCode:302,skipSettingLocaleOnNavigate:false,locales:[],detectBrowserLanguage:{alwaysRedirect:false,cookieCrossOrigin:false,cookieDomain:"",cookieKey:"i18n_redirected",cookieSecure:false,fallbackLocale:"",redirectOn:"root",useCookie:true},experimental:{localeDetector:"",typedPages:true,typedOptionsAndMessages:false,alternateLinkCanonicalQueries:true,devCache:false,cacheLifetime:"",stripMessagesPayload:false,preload:false,strictSeo:false,nitroContextDetection:true,httpCacheDuration:10},domainLocales:{}}},app:{baseURL:"/__nuxt-seo-utils",buildId:"ec94f51b-9527-4bce-bb44-c3a921ddc064",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776312093332,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="/__nuxt-seo-utils/_nuxt/entry.
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-seo-utils/_nuxt/entry.DZPkkv65.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-seo-utils/_nuxt/BlLJGL5m.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BlLJGL5m.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:{i18n:{baseUrl:"",defaultLocale:"",rootRedirect:"",redirectStatusCode:302,skipSettingLocaleOnNavigate:false,locales:[],detectBrowserLanguage:{alwaysRedirect:false,cookieCrossOrigin:false,cookieDomain:"",cookieKey:"i18n_redirected",cookieSecure:false,fallbackLocale:"",redirectOn:"root",useCookie:true},experimental:{localeDetector:"",typedPages:true,typedOptionsAndMessages:false,alternateLinkCanonicalQueries:true,devCache:false,cacheLifetime:"",stripMessagesPayload:false,preload:false,strictSeo:false,nitroContextDetection:true,httpCacheDuration:10},domainLocales:{}}},app:{baseURL:"/__nuxt-seo-utils",buildId:"ec94f51b-9527-4bce-bb44-c3a921ddc064",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776312093332,false]</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs, { existsSync } from 'node:fs';
|
|
2
2
|
import { useNuxt, addTypeTemplate, useLogger, defineNuxtModule, createResolver, addServerHandler, hasNuxtModule, addPlugin, addImports, addVitePlugin } from '@nuxt/kit';
|
|
3
|
-
import UnheadVite from '@unhead/addons/vite';
|
|
4
3
|
import { defu } from 'defu';
|
|
5
4
|
import { installNuxtSiteConfig } from 'nuxt-site-config/kit';
|
|
6
5
|
import { resolve, extname, relative, dirname, basename } from 'pathe';
|
|
@@ -393,9 +392,6 @@ async function generateTagsFromPublicFiles(nuxt = useNuxt()) {
|
|
|
393
392
|
return { hasIcons };
|
|
394
393
|
}
|
|
395
394
|
|
|
396
|
-
const INLINE_SCRIPT_RE = /<script(?![^>]+\bsrc\b)([^>]*)>([\s\S]*?)<\/script\s*>/gi;
|
|
397
|
-
const INLINE_STYLE_RE = /<style([^>]*)>([\s\S]*?)<\/style\s*>/gi;
|
|
398
|
-
const TYPE_ATTR_RE = /\btype\s*=\s*["']([^"']*)["']/i;
|
|
399
395
|
const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
400
396
|
const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
401
397
|
const logger = useLogger("nuxt-seo-utils");
|
|
@@ -436,7 +432,7 @@ async function minifyCSSWithLightningCSS(code) {
|
|
|
436
432
|
return null;
|
|
437
433
|
}
|
|
438
434
|
}
|
|
439
|
-
function
|
|
435
|
+
function minifyStaticHead() {
|
|
440
436
|
const nuxt = useNuxt();
|
|
441
437
|
nuxt.hooks.hook("app:resolve", async () => {
|
|
442
438
|
const head = nuxt.options.app.head;
|
|
@@ -490,62 +486,6 @@ function minifyPrerender() {
|
|
|
490
486
|
}
|
|
491
487
|
await Promise.all(promises);
|
|
492
488
|
});
|
|
493
|
-
nuxt.hooks.hook("nitro:init", (nitro) => {
|
|
494
|
-
nitro.hooks.hook("prerender:generate", async (route) => {
|
|
495
|
-
if (!route.contents || !route.contentType?.includes("html"))
|
|
496
|
-
return;
|
|
497
|
-
route.contents = await replaceAsync(
|
|
498
|
-
route.contents,
|
|
499
|
-
new RegExp(INLINE_SCRIPT_RE.source, INLINE_SCRIPT_RE.flags),
|
|
500
|
-
async (fullMatch, attrs, content) => {
|
|
501
|
-
if (!content)
|
|
502
|
-
return fullMatch;
|
|
503
|
-
const typeMatch = TYPE_ATTR_RE.exec(attrs);
|
|
504
|
-
const type = typeMatch?.[1];
|
|
505
|
-
if (type && JSON_TYPES.has(type)) {
|
|
506
|
-
try {
|
|
507
|
-
const minified2 = JSON.stringify(JSON.parse(content));
|
|
508
|
-
if (minified2.length < content.length)
|
|
509
|
-
return `<script${attrs}>${minified2}<\/script>`;
|
|
510
|
-
} catch {
|
|
511
|
-
}
|
|
512
|
-
return fullMatch;
|
|
513
|
-
}
|
|
514
|
-
if (type && SKIP_JS_TYPES.has(type))
|
|
515
|
-
return fullMatch;
|
|
516
|
-
const minified = await minifyJSBuildTime(content);
|
|
517
|
-
if (minified && minified.length < content.length)
|
|
518
|
-
return `<script${attrs}>${minified}<\/script>`;
|
|
519
|
-
return fullMatch;
|
|
520
|
-
}
|
|
521
|
-
);
|
|
522
|
-
route.contents = await replaceAsync(
|
|
523
|
-
route.contents,
|
|
524
|
-
new RegExp(INLINE_STYLE_RE.source, INLINE_STYLE_RE.flags),
|
|
525
|
-
async (fullMatch, attrs, content) => {
|
|
526
|
-
if (!content)
|
|
527
|
-
return fullMatch;
|
|
528
|
-
const minified = await minifyCSSWithLightningCSS(content);
|
|
529
|
-
if (minified && minified.length < content.length)
|
|
530
|
-
return `<style${attrs}>${minified}</style>`;
|
|
531
|
-
return fullMatch;
|
|
532
|
-
}
|
|
533
|
-
);
|
|
534
|
-
});
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
async function replaceAsync(str, regex, asyncFn) {
|
|
538
|
-
const matches = [];
|
|
539
|
-
const re = new RegExp(regex.source, regex.flags);
|
|
540
|
-
for (let m = re.exec(str); m !== null; m = re.exec(str))
|
|
541
|
-
matches.push({ match: m, replacement: asyncFn(...m) });
|
|
542
|
-
const replacements = await Promise.all(matches.map((m) => m.replacement));
|
|
543
|
-
let result = str;
|
|
544
|
-
for (let i = matches.length - 1; i >= 0; i--) {
|
|
545
|
-
const { match } = matches[i];
|
|
546
|
-
result = result.slice(0, match.index) + replacements[i] + result.slice(match.index + match[0].length);
|
|
547
|
-
}
|
|
548
|
-
return result;
|
|
549
489
|
}
|
|
550
490
|
|
|
551
491
|
function setupNuxtConfigAppHeadWithMoreDefaults(nuxt = useNuxt()) {
|
|
@@ -698,6 +638,7 @@ const module$1 = defineNuxtModule({
|
|
|
698
638
|
});
|
|
699
639
|
});
|
|
700
640
|
nuxt.options.experimental.headNext = true;
|
|
641
|
+
const headTemplateParams = nuxt.options.app.head?.templateParams;
|
|
701
642
|
if (!nuxt.options.dev && config.redirectToCanonicalSiteUrl) {
|
|
702
643
|
addServerHandler({
|
|
703
644
|
handler: resolve(runtimeDir, "./server/middleware/redirectCanonical"),
|
|
@@ -717,7 +658,9 @@ const module$1 = defineNuxtModule({
|
|
|
717
658
|
"tag"
|
|
718
659
|
],
|
|
719
660
|
canonicalLowercase: config.canonicalLowercase,
|
|
720
|
-
tagPriority: config.tagPriority
|
|
661
|
+
tagPriority: config.tagPriority,
|
|
662
|
+
separator: headTemplateParams?.separator,
|
|
663
|
+
titleSeparator: headTemplateParams?.titleSeparator
|
|
721
664
|
});
|
|
722
665
|
if (config.extendNuxtConfigAppHeadSeoMeta)
|
|
723
666
|
extendNuxtConfigAppHeadSeoMeta();
|
|
@@ -767,7 +710,18 @@ export {}
|
|
|
767
710
|
});
|
|
768
711
|
const appRuntimeDir = resolve(runtimeDir, "./app");
|
|
769
712
|
if (config.treeShakeUseSeoMeta) {
|
|
770
|
-
|
|
713
|
+
const unheadPkg = await readPackageJSON("@unhead/vue", { from: nuxt.options.rootDir }).catch(() => null);
|
|
714
|
+
const unheadMajor = Number.parseInt((unheadPkg?.version || "2").split(".")[0], 10);
|
|
715
|
+
addVitePlugin(async () => {
|
|
716
|
+
if (unheadMajor >= 3) {
|
|
717
|
+
const v3Vite = "@unhead/vue/vite";
|
|
718
|
+
const { Unhead } = await import(v3Vite);
|
|
719
|
+
return Unhead();
|
|
720
|
+
}
|
|
721
|
+
const v2Vite = "@unhead/addons/vite";
|
|
722
|
+
const { default: UnheadVite } = await import(v2Vite);
|
|
723
|
+
return UnheadVite();
|
|
724
|
+
}, {
|
|
771
725
|
prepend: true
|
|
772
726
|
});
|
|
773
727
|
}
|
|
@@ -791,7 +745,12 @@ export {}
|
|
|
791
745
|
});
|
|
792
746
|
}
|
|
793
747
|
if (minifyOpts.build !== false) {
|
|
794
|
-
|
|
748
|
+
minifyStaticHead();
|
|
749
|
+
const minifyHtmlPlugin = resolve(runtimeDir, "./server/plugins/minifyHtml");
|
|
750
|
+
nuxt.hook("nitro:config", (nitroConfig) => {
|
|
751
|
+
nitroConfig.plugins ||= [];
|
|
752
|
+
nitroConfig.plugins.unshift(minifyHtmlPlugin);
|
|
753
|
+
});
|
|
795
754
|
}
|
|
796
755
|
}
|
|
797
756
|
if (config.debug || nuxt.options.dev) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSiteConfig } from "#site-config/app/composables/useSiteConfig";
|
|
2
2
|
import { createSitePathResolver } from "#site-config/app/composables/utils";
|
|
3
|
-
import { injectHead, useHead, useSeoMeta
|
|
3
|
+
import { injectHead, useHead, useSeoMeta } from "@unhead/vue";
|
|
4
4
|
import { TemplateParamsPlugin } from "@unhead/vue/plugins";
|
|
5
5
|
import { useError, useRoute, useRuntimeConfig } from "nuxt/app";
|
|
6
6
|
import { stringifyQuery } from "ufo";
|
|
@@ -16,10 +16,12 @@ export function applyDefaults() {
|
|
|
16
16
|
};
|
|
17
17
|
const head = injectHead();
|
|
18
18
|
head.use(TemplateParamsPlugin);
|
|
19
|
-
const { canonicalQueryWhitelist, canonicalLowercase, tagPriority } = useRuntimeConfig().public["seo-utils"];
|
|
19
|
+
const { canonicalQueryWhitelist, canonicalLowercase, tagPriority, separator, titleSeparator } = useRuntimeConfig().public["seo-utils"];
|
|
20
20
|
const route = useRoute();
|
|
21
21
|
const resolveUrl = createSitePathResolver({ withBase: true, absolute: true });
|
|
22
22
|
const err = useError();
|
|
23
|
+
const resolveSeparator = () => toValue(siteConfig.separator) || separator || toValue(siteConfig.titleSeparator) || titleSeparator;
|
|
24
|
+
const resolveTitleSeparator = () => toValue(siteConfig.titleSeparator) || titleSeparator || toValue(siteConfig.separator) || separator;
|
|
23
25
|
const canonicalUrl = computed(() => {
|
|
24
26
|
if (err.value) {
|
|
25
27
|
return false;
|
|
@@ -51,7 +53,9 @@ export function applyDefaults() {
|
|
|
51
53
|
htmlAttrs: { lang: resolveCurrentLocale },
|
|
52
54
|
templateParams: {
|
|
53
55
|
site: () => siteConfig,
|
|
54
|
-
siteName: () => siteConfig.name
|
|
56
|
+
siteName: () => siteConfig.name,
|
|
57
|
+
separator: resolveSeparator,
|
|
58
|
+
titleSeparator: resolveTitleSeparator
|
|
55
59
|
},
|
|
56
60
|
titleTemplate: () => err.value ? "%s" : "%s %separator %siteName",
|
|
57
61
|
link: [() => canonicalUrl.value]
|
|
@@ -76,8 +80,8 @@ export function applyDefaults() {
|
|
|
76
80
|
},
|
|
77
81
|
ogSiteName: siteConfig.name
|
|
78
82
|
};
|
|
79
|
-
if (siteConfig.description)
|
|
80
|
-
|
|
83
|
+
if (import.meta.server && siteConfig.description)
|
|
84
|
+
useSeoMeta({ description: siteConfig.description }, minimalPriority);
|
|
81
85
|
if (siteConfig.twitter) {
|
|
82
86
|
const id = siteConfig.twitter.startsWith("@") ? siteConfig.twitter : `@${siteConfig.twitter}`;
|
|
83
87
|
seoMeta.twitterCreator = id;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { InferSeoMetaPlugin } from "@unhead/addons";
|
|
2
1
|
import { injectHead } from "@unhead/vue";
|
|
2
|
+
import { InferSeoMetaPlugin, TemplateParamsPlugin } from "@unhead/vue/plugins";
|
|
3
3
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
4
|
-
import { TemplateParamsPlugin } from "unhead/plugins";
|
|
5
4
|
export default defineNuxtPlugin(() => {
|
|
6
5
|
const head = injectHead();
|
|
7
6
|
if (!head)
|
|
@@ -5,8 +5,10 @@ export default defineNuxtPlugin(() => {
|
|
|
5
5
|
const head = injectHead();
|
|
6
6
|
if (!head)
|
|
7
7
|
return;
|
|
8
|
-
const { tagPriority } = useRuntimeConfig().public["seo-utils"];
|
|
8
|
+
const { tagPriority, separator, titleSeparator } = useRuntimeConfig().public["seo-utils"];
|
|
9
9
|
const siteConfig = useSiteConfig();
|
|
10
|
+
const resolvedSeparator = siteConfig.separator || separator || siteConfig.titleSeparator || titleSeparator;
|
|
11
|
+
const resolvedTitleSeparator = siteConfig.titleSeparator || titleSeparator || siteConfig.separator || separator;
|
|
10
12
|
const input = {
|
|
11
13
|
meta: [],
|
|
12
14
|
templateParams: {
|
|
@@ -16,10 +18,10 @@ export default defineNuxtPlugin(() => {
|
|
|
16
18
|
siteName: siteConfig.name
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
|
-
if (
|
|
20
|
-
input.templateParams.separator =
|
|
21
|
-
if (
|
|
22
|
-
input.templateParams.titleSeparator =
|
|
21
|
+
if (resolvedSeparator)
|
|
22
|
+
input.templateParams.separator = resolvedSeparator;
|
|
23
|
+
if (resolvedTitleSeparator)
|
|
24
|
+
input.templateParams.titleSeparator = resolvedTitleSeparator;
|
|
23
25
|
if (siteConfig.description) {
|
|
24
26
|
input.templateParams.siteDescription = siteConfig.description;
|
|
25
27
|
input.meta.push(
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineNitroPlugin } from "nitropack/runtime";
|
|
2
|
+
import { minifyCSS, minifyJS, minifyJSON } from "../../shared/minify.js";
|
|
3
|
+
const INLINE_SCRIPT_RE = /<script(?![^>]+\bsrc\b)([^>]*)>([\s\S]*?)<\/script\s*>/gi;
|
|
4
|
+
const INLINE_STYLE_RE = /<style([^>]*)>([\s\S]*?)<\/style\s*>/gi;
|
|
5
|
+
const TYPE_ATTR_RE = /\btype\s*=\s*["']([^"']*)["']/i;
|
|
6
|
+
const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
7
|
+
const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
8
|
+
function minifyChunk(chunk) {
|
|
9
|
+
let out = chunk.replace(INLINE_SCRIPT_RE, (full, attrs, content) => {
|
|
10
|
+
if (!content)
|
|
11
|
+
return full;
|
|
12
|
+
const type = TYPE_ATTR_RE.exec(attrs)?.[1];
|
|
13
|
+
if (type && JSON_TYPES.has(type)) {
|
|
14
|
+
try {
|
|
15
|
+
const m = minifyJSON(content);
|
|
16
|
+
return m.length < content.length ? `<script${attrs}>${m}<\/script>` : full;
|
|
17
|
+
} catch {
|
|
18
|
+
return full;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (type && SKIP_JS_TYPES.has(type))
|
|
22
|
+
return full;
|
|
23
|
+
try {
|
|
24
|
+
const m = minifyJS(content);
|
|
25
|
+
return m.length < content.length ? `<script${attrs}>${m}<\/script>` : full;
|
|
26
|
+
} catch {
|
|
27
|
+
return full;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
out = out.replace(INLINE_STYLE_RE, (full, attrs, content) => {
|
|
31
|
+
if (!content)
|
|
32
|
+
return full;
|
|
33
|
+
try {
|
|
34
|
+
const m = minifyCSS(content);
|
|
35
|
+
return m.length < content.length ? `<style${attrs}>${m}</style>` : full;
|
|
36
|
+
} catch {
|
|
37
|
+
return full;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
export default defineNitroPlugin((nitroApp) => {
|
|
43
|
+
if (!import.meta.prerender)
|
|
44
|
+
return;
|
|
45
|
+
nitroApp.hooks.hook("render:html", (html) => {
|
|
46
|
+
for (const arr of [html.head, html.bodyPrepend, html.body, html.bodyAppend]) {
|
|
47
|
+
for (let i = 0; i < arr.length; i++)
|
|
48
|
+
arr[i] = minifyChunk(arr[i]);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-seo-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.1.
|
|
4
|
+
"version": "8.1.9",
|
|
5
5
|
"description": "SEO utilities to improve your Nuxt sites discoverability and shareability",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"unhead",
|
|
33
33
|
"@unhead/vue",
|
|
34
34
|
"@unhead/vue/plugins",
|
|
35
|
-
"@unhead/vue/utils"
|
|
35
|
+
"@unhead/vue/utils",
|
|
36
|
+
"@unhead/vue/vite",
|
|
37
|
+
"@unhead/addons/vite"
|
|
36
38
|
]
|
|
37
39
|
},
|
|
38
40
|
"peerDependencies": {
|
|
@@ -54,43 +56,44 @@
|
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
58
|
"@nuxt/kit": "^4.4.2",
|
|
57
|
-
"@unhead/addons": "^2.1.13",
|
|
59
|
+
"@unhead/addons": "^2.1.13 || ^3.0.0",
|
|
58
60
|
"citty": "^0.2.2",
|
|
59
61
|
"defu": "^6.1.7",
|
|
60
62
|
"escape-string-regexp": "^5.0.0",
|
|
61
63
|
"image-size": "^2.0.2",
|
|
62
|
-
"nuxt-site-config": "^4.0.
|
|
63
|
-
"nuxtseo-shared": "^5.1.
|
|
64
|
+
"nuxt-site-config": "^4.0.8",
|
|
65
|
+
"nuxtseo-shared": "^5.1.3",
|
|
64
66
|
"pathe": "^2.0.3",
|
|
65
67
|
"pkg-types": "^2.3.0",
|
|
66
68
|
"scule": "^1.3.0",
|
|
67
|
-
"tinyglobby": "^0.2.
|
|
69
|
+
"tinyglobby": "^0.2.16",
|
|
68
70
|
"ufo": "^1.6.3"
|
|
69
71
|
},
|
|
70
72
|
"optionalDependencies": {
|
|
71
73
|
"sharp": "^0.34.5"
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
|
-
"@antfu/eslint-config": "^8.
|
|
76
|
+
"@antfu/eslint-config": "^8.2.0",
|
|
75
77
|
"@nuxt/devtools-kit": "4.0.0-alpha.3",
|
|
76
78
|
"@nuxt/module-builder": "^1.0.2",
|
|
77
79
|
"@nuxt/schema": "^4.4.2",
|
|
78
|
-
"@nuxt/test-utils": "^4.0.
|
|
80
|
+
"@nuxt/test-utils": "^4.0.2",
|
|
79
81
|
"@nuxt/ui": "^4.6.1",
|
|
80
82
|
"@nuxtjs/i18n": "^10.2.4",
|
|
81
|
-
"@types/node": "^25.
|
|
82
|
-
"@unhead/vue": "^2.1.13",
|
|
83
|
+
"@types/node": "^25.6.0",
|
|
84
|
+
"@unhead/vue": "^2.1.13 || ^3.0.0",
|
|
83
85
|
"@vue/test-utils": "^2.4.6",
|
|
84
86
|
"bumpp": "^11.0.1",
|
|
85
|
-
"case-police": "^2.2.
|
|
87
|
+
"case-police": "^2.2.1",
|
|
86
88
|
"cheerio": "^1.2.0",
|
|
87
89
|
"eslint": "^10.2.0",
|
|
88
|
-
"eslint-plugin-harlanzw": "^0.12.
|
|
89
|
-
"happy-dom": "^20.
|
|
90
|
+
"eslint-plugin-harlanzw": "^0.12.1",
|
|
91
|
+
"happy-dom": "^20.9.0",
|
|
90
92
|
"lint-staged": "^16.4.0",
|
|
91
93
|
"markdownlint-cli": "^0.48.0",
|
|
92
94
|
"nuxt": "^4.4.2",
|
|
93
|
-
"
|
|
95
|
+
"nuxt-security": "^2.5.1",
|
|
96
|
+
"nuxtseo-layer-devtools": "^5.1.3",
|
|
94
97
|
"playwright-core": "^1.59.1",
|
|
95
98
|
"sass": "^1.99.0",
|
|
96
99
|
"semver": "^7.7.4",
|
|
@@ -98,7 +101,7 @@
|
|
|
98
101
|
"typescript": "^6.0.2",
|
|
99
102
|
"ultrahtml": "^1.6.0",
|
|
100
103
|
"unbuild": "^3.6.1",
|
|
101
|
-
"vitest": "^4.1.
|
|
104
|
+
"vitest": "^4.1.4",
|
|
102
105
|
"vue-tsc": "^3.2.6"
|
|
103
106
|
},
|
|
104
107
|
"scripts": {
|
|
@@ -111,7 +114,7 @@
|
|
|
111
114
|
"lint": "eslint .",
|
|
112
115
|
"lint:fix": "eslint . --fix",
|
|
113
116
|
"typecheck": "nuxt typecheck",
|
|
114
|
-
"prepare:fixtures": "nuxt prepare test/fixtures/basic && nuxt prepare test/fixtures/i18n",
|
|
117
|
+
"prepare:fixtures": "nuxt prepare test/fixtures/basic && nuxt prepare test/fixtures/i18n && nuxt prepare test/fixtures/csp",
|
|
115
118
|
"test": "vitest",
|
|
116
119
|
"test:run": "vitest run --exclude '**/\\_\\_runtime\\_\\_/**'",
|
|
117
120
|
"test:runtime": "cd test/fixtures/basic && vitest --run",
|