nuxt-seo-utils 8.1.7 → 8.1.8
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/{DQME8n2D.js → 4KpTtx9F.js} +1 -1
- package/dist/devtools/_nuxt/BEcxVnVC.js +33 -0
- package/dist/devtools/_nuxt/{Dw3QrPVs.js → BNgJYF4-.js} +1 -1
- package/dist/devtools/_nuxt/{CuJoTDlq.js → BRD_U32-.js} +1 -1
- package/dist/devtools/_nuxt/{BtSCtnKE.js → Bywdn9yM.js} +1 -1
- package/dist/devtools/_nuxt/{B8ldmQbT.js → CPBXREPo.js} +1 -1
- package/dist/devtools/_nuxt/{D65AfcxY.js → Cy-qCfrn.js} +1 -1
- package/dist/devtools/_nuxt/{Cpq8TB1h.js → DIKkjqSm.js} +1 -1
- package/dist/devtools/_nuxt/DevtoolsMetric.B0IT7l09.css +1 -0
- package/dist/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/devtools/_nuxt/builds/meta/a24989ac-6153-4246-bbab-8496d363a82d.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 +7 -61
- package/dist/runtime/server/plugins/minifyHtml.d.ts +2 -0
- package/dist/runtime/server/plugins/minifyHtml.js +51 -0
- package/package.json +13 -12
- 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/BEcxVnVC.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BEcxVnVC.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:"a24989ac-6153-4246-bbab-8496d363a82d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776152524777,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/BEcxVnVC.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BEcxVnVC.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:"a24989ac-6153-4246-bbab-8496d363a82d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776152524779,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/BEcxVnVC.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BEcxVnVC.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:"a24989ac-6153-4246-bbab-8496d363a82d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776152524779,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/BEcxVnVC.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BEcxVnVC.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:"a24989ac-6153-4246-bbab-8496d363a82d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776152524779,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/BEcxVnVC.js"><script type="module" src="/__nuxt-seo-utils/_nuxt/BEcxVnVC.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:"a24989ac-6153-4246-bbab-8496d363a82d",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1776152524779,false]</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -393,9 +393,6 @@ async function generateTagsFromPublicFiles(nuxt = useNuxt()) {
|
|
|
393
393
|
return { hasIcons };
|
|
394
394
|
}
|
|
395
395
|
|
|
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
396
|
const JSON_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json"]);
|
|
400
397
|
const SKIP_JS_TYPES = /* @__PURE__ */ new Set(["application/json", "application/ld+json", "speculationrules", "importmap"]);
|
|
401
398
|
const logger = useLogger("nuxt-seo-utils");
|
|
@@ -436,7 +433,7 @@ async function minifyCSSWithLightningCSS(code) {
|
|
|
436
433
|
return null;
|
|
437
434
|
}
|
|
438
435
|
}
|
|
439
|
-
function
|
|
436
|
+
function minifyStaticHead() {
|
|
440
437
|
const nuxt = useNuxt();
|
|
441
438
|
nuxt.hooks.hook("app:resolve", async () => {
|
|
442
439
|
const head = nuxt.options.app.head;
|
|
@@ -490,62 +487,6 @@ function minifyPrerender() {
|
|
|
490
487
|
}
|
|
491
488
|
await Promise.all(promises);
|
|
492
489
|
});
|
|
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
490
|
}
|
|
550
491
|
|
|
551
492
|
function setupNuxtConfigAppHeadWithMoreDefaults(nuxt = useNuxt()) {
|
|
@@ -791,7 +732,12 @@ export {}
|
|
|
791
732
|
});
|
|
792
733
|
}
|
|
793
734
|
if (minifyOpts.build !== false) {
|
|
794
|
-
|
|
735
|
+
minifyStaticHead();
|
|
736
|
+
const minifyHtmlPlugin = resolve(runtimeDir, "./server/plugins/minifyHtml");
|
|
737
|
+
nuxt.hook("nitro:config", (nitroConfig) => {
|
|
738
|
+
nitroConfig.plugins ||= [];
|
|
739
|
+
nitroConfig.plugins.unshift(minifyHtmlPlugin);
|
|
740
|
+
});
|
|
795
741
|
}
|
|
796
742
|
}
|
|
797
743
|
if (config.debug || nuxt.options.dev) {
|
|
@@ -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.8",
|
|
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",
|
|
@@ -59,38 +59,39 @@
|
|
|
59
59
|
"defu": "^6.1.7",
|
|
60
60
|
"escape-string-regexp": "^5.0.0",
|
|
61
61
|
"image-size": "^2.0.2",
|
|
62
|
-
"nuxt-site-config": "^4.0.
|
|
63
|
-
"nuxtseo-shared": "^5.1.
|
|
62
|
+
"nuxt-site-config": "^4.0.8",
|
|
63
|
+
"nuxtseo-shared": "^5.1.3",
|
|
64
64
|
"pathe": "^2.0.3",
|
|
65
65
|
"pkg-types": "^2.3.0",
|
|
66
66
|
"scule": "^1.3.0",
|
|
67
|
-
"tinyglobby": "^0.2.
|
|
67
|
+
"tinyglobby": "^0.2.16",
|
|
68
68
|
"ufo": "^1.6.3"
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
71
|
"sharp": "^0.34.5"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@antfu/eslint-config": "^8.
|
|
74
|
+
"@antfu/eslint-config": "^8.2.0",
|
|
75
75
|
"@nuxt/devtools-kit": "4.0.0-alpha.3",
|
|
76
76
|
"@nuxt/module-builder": "^1.0.2",
|
|
77
77
|
"@nuxt/schema": "^4.4.2",
|
|
78
|
-
"@nuxt/test-utils": "^4.0.
|
|
78
|
+
"@nuxt/test-utils": "^4.0.2",
|
|
79
79
|
"@nuxt/ui": "^4.6.1",
|
|
80
80
|
"@nuxtjs/i18n": "^10.2.4",
|
|
81
|
-
"@types/node": "^25.
|
|
81
|
+
"@types/node": "^25.6.0",
|
|
82
82
|
"@unhead/vue": "^2.1.13",
|
|
83
83
|
"@vue/test-utils": "^2.4.6",
|
|
84
84
|
"bumpp": "^11.0.1",
|
|
85
85
|
"case-police": "^2.2.0",
|
|
86
86
|
"cheerio": "^1.2.0",
|
|
87
87
|
"eslint": "^10.2.0",
|
|
88
|
-
"eslint-plugin-harlanzw": "^0.12.
|
|
89
|
-
"happy-dom": "^20.
|
|
88
|
+
"eslint-plugin-harlanzw": "^0.12.1",
|
|
89
|
+
"happy-dom": "^20.9.0",
|
|
90
90
|
"lint-staged": "^16.4.0",
|
|
91
91
|
"markdownlint-cli": "^0.48.0",
|
|
92
92
|
"nuxt": "^4.4.2",
|
|
93
|
-
"
|
|
93
|
+
"nuxt-security": "^2.5.1",
|
|
94
|
+
"nuxtseo-layer-devtools": "^5.1.3",
|
|
94
95
|
"playwright-core": "^1.59.1",
|
|
95
96
|
"sass": "^1.99.0",
|
|
96
97
|
"semver": "^7.7.4",
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
"typescript": "^6.0.2",
|
|
99
100
|
"ultrahtml": "^1.6.0",
|
|
100
101
|
"unbuild": "^3.6.1",
|
|
101
|
-
"vitest": "^4.1.
|
|
102
|
+
"vitest": "^4.1.4",
|
|
102
103
|
"vue-tsc": "^3.2.6"
|
|
103
104
|
},
|
|
104
105
|
"scripts": {
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
"lint": "eslint .",
|
|
112
113
|
"lint:fix": "eslint . --fix",
|
|
113
114
|
"typecheck": "nuxt typecheck",
|
|
114
|
-
"prepare:fixtures": "nuxt prepare test/fixtures/basic && nuxt prepare test/fixtures/i18n",
|
|
115
|
+
"prepare:fixtures": "nuxt prepare test/fixtures/basic && nuxt prepare test/fixtures/i18n && nuxt prepare test/fixtures/csp",
|
|
115
116
|
"test": "vitest",
|
|
116
117
|
"test:run": "vitest run --exclude '**/\\_\\_runtime\\_\\_/**'",
|
|
117
118
|
"test:runtime": "cd test/fixtures/basic && vitest --run",
|